kernel: bump 4.9 to 4.9.63
[openwrt/openwrt.git] / target / linux / layerscape / patches-4.9 / 701-sdk_dpaa-support-layerscape.patch
1 From 3cd36deb674720ab34eabb9783648ed743e52121 Mon Sep 17 00:00:00 2001
2 From: Yangbo Lu <yangbo.lu@nxp.com>
3 Date: Mon, 25 Sep 2017 11:58:03 +0800
4 Subject: [PATCH] sdk_dpaa: support layerscape
5
6 This is a integrated patch for layerscape dpaa1-sdk support.
7
8 Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
9 Signed-off-by: Zhao Qiang <qiang.zhao@nxp.com>
10 Signed-off-by: Zhang Ying-22455 <ying.zhang22455@nxp.com>
11 Signed-off-by: Madalin Bucur <madalin.bucur@nxp.com>
12 Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
13 ---
14 drivers/net/ethernet/freescale/sdk_dpaa/Kconfig | 173 +
15 drivers/net/ethernet/freescale/sdk_dpaa/Makefile | 46 +
16 .../net/ethernet/freescale/sdk_dpaa/dpaa_1588.c | 580 ++
17 .../net/ethernet/freescale/sdk_dpaa/dpaa_1588.h | 138 +
18 .../net/ethernet/freescale/sdk_dpaa/dpaa_debugfs.c | 180 +
19 .../net/ethernet/freescale/sdk_dpaa/dpaa_debugfs.h | 43 +
20 drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth.c | 1213 ++++
21 drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth.h | 687 ++
22 .../ethernet/freescale/sdk_dpaa/dpaa_eth_base.c | 205 +
23 .../ethernet/freescale/sdk_dpaa/dpaa_eth_base.h | 49 +
24 .../ethernet/freescale/sdk_dpaa/dpaa_eth_ceetm.c | 1992 +++++
25 .../ethernet/freescale/sdk_dpaa/dpaa_eth_ceetm.h | 237 +
26 .../ethernet/freescale/sdk_dpaa/dpaa_eth_common.c | 1820 +++++
27 .../ethernet/freescale/sdk_dpaa/dpaa_eth_common.h | 225 +
28 .../ethernet/freescale/sdk_dpaa/dpaa_eth_proxy.c | 381 +
29 .../net/ethernet/freescale/sdk_dpaa/dpaa_eth_sg.c | 1168 +++
30 .../ethernet/freescale/sdk_dpaa/dpaa_eth_sysfs.c | 278 +
31 .../ethernet/freescale/sdk_dpaa/dpaa_eth_trace.h | 144 +
32 .../net/ethernet/freescale/sdk_dpaa/dpaa_ethtool.c | 544 ++
33 drivers/net/ethernet/freescale/sdk_dpaa/dpaa_ptp.c | 291 +
34 drivers/net/ethernet/freescale/sdk_dpaa/mac-api.c | 907 +++
35 drivers/net/ethernet/freescale/sdk_dpaa/mac.c | 489 ++
36 drivers/net/ethernet/freescale/sdk_dpaa/mac.h | 135 +
37 .../net/ethernet/freescale/sdk_dpaa/offline_port.c | 848 +++
38 .../net/ethernet/freescale/sdk_dpaa/offline_port.h | 59 +
39 drivers/net/ethernet/freescale/sdk_fman/Kconfig | 153 +
40 drivers/net/ethernet/freescale/sdk_fman/Makefile | 11 +
41 .../freescale/sdk_fman/Peripherals/FM/HC/Makefile | 15 +
42 .../freescale/sdk_fman/Peripherals/FM/HC/hc.c | 1232 ++++
43 .../freescale/sdk_fman/Peripherals/FM/MAC/Makefile | 28 +
44 .../freescale/sdk_fman/Peripherals/FM/MAC/dtsec.c | 1465 ++++
45 .../freescale/sdk_fman/Peripherals/FM/MAC/dtsec.h | 228 +
46 .../sdk_fman/Peripherals/FM/MAC/dtsec_mii_acc.c | 97 +
47 .../sdk_fman/Peripherals/FM/MAC/dtsec_mii_acc.h | 42 +
48 .../freescale/sdk_fman/Peripherals/FM/MAC/fm_mac.c | 674 ++
49 .../freescale/sdk_fman/Peripherals/FM/MAC/fm_mac.h | 226 +
50 .../sdk_fman/Peripherals/FM/MAC/fman_crc32.c | 119 +
51 .../sdk_fman/Peripherals/FM/MAC/fman_crc32.h | 43 +
52 .../sdk_fman/Peripherals/FM/MAC/fman_dtsec.c | 845 +++
53 .../Peripherals/FM/MAC/fman_dtsec_mii_acc.c | 163 +
54 .../sdk_fman/Peripherals/FM/MAC/fman_memac.c | 532 ++
55 .../Peripherals/FM/MAC/fman_memac_mii_acc.c | 213 +
56 .../sdk_fman/Peripherals/FM/MAC/fman_tgec.c | 367 +
57 .../freescale/sdk_fman/Peripherals/FM/MAC/memac.c | 1153 +++
58 .../freescale/sdk_fman/Peripherals/FM/MAC/memac.h | 110 +
59 .../sdk_fman/Peripherals/FM/MAC/memac_mii_acc.c | 78 +
60 .../sdk_fman/Peripherals/FM/MAC/memac_mii_acc.h | 73 +
61 .../freescale/sdk_fman/Peripherals/FM/MAC/tgec.c | 1017 +++
62 .../freescale/sdk_fman/Peripherals/FM/MAC/tgec.h | 151 +
63 .../sdk_fman/Peripherals/FM/MAC/tgec_mii_acc.c | 139 +
64 .../sdk_fman/Peripherals/FM/MAC/tgec_mii_acc.h | 80 +
65 .../sdk_fman/Peripherals/FM/MACSEC/Makefile | 15 +
66 .../sdk_fman/Peripherals/FM/MACSEC/fm_macsec.c | 237 +
67 .../sdk_fman/Peripherals/FM/MACSEC/fm_macsec.h | 203 +
68 .../Peripherals/FM/MACSEC/fm_macsec_guest.c | 59 +
69 .../Peripherals/FM/MACSEC/fm_macsec_master.c | 1031 +++
70 .../Peripherals/FM/MACSEC/fm_macsec_master.h | 479 ++
71 .../Peripherals/FM/MACSEC/fm_macsec_secy.c | 883 +++
72 .../Peripherals/FM/MACSEC/fm_macsec_secy.h | 144 +
73 .../freescale/sdk_fman/Peripherals/FM/Makefile | 23 +
74 .../freescale/sdk_fman/Peripherals/FM/Pcd/Makefile | 26 +
75 .../freescale/sdk_fman/Peripherals/FM/Pcd/crc64.h | 360 +
76 .../freescale/sdk_fman/Peripherals/FM/Pcd/fm_cc.c | 7582 ++++++++++++++++++++
77 .../freescale/sdk_fman/Peripherals/FM/Pcd/fm_cc.h | 399 +
78 .../freescale/sdk_fman/Peripherals/FM/Pcd/fm_kg.c | 3242 +++++++++
79 .../freescale/sdk_fman/Peripherals/FM/Pcd/fm_kg.h | 206 +
80 .../sdk_fman/Peripherals/FM/Pcd/fm_manip.c | 5571 ++++++++++++++
81 .../sdk_fman/Peripherals/FM/Pcd/fm_manip.h | 555 ++
82 .../freescale/sdk_fman/Peripherals/FM/Pcd/fm_pcd.c | 2095 ++++++
83 .../freescale/sdk_fman/Peripherals/FM/Pcd/fm_pcd.h | 543 ++
84 .../sdk_fman/Peripherals/FM/Pcd/fm_pcd_ipc.h | 280 +
85 .../sdk_fman/Peripherals/FM/Pcd/fm_plcr.c | 1847 +++++
86 .../sdk_fman/Peripherals/FM/Pcd/fm_plcr.h | 165 +
87 .../freescale/sdk_fman/Peripherals/FM/Pcd/fm_prs.c | 423 ++
88 .../freescale/sdk_fman/Peripherals/FM/Pcd/fm_prs.h | 316 +
89 .../sdk_fman/Peripherals/FM/Pcd/fm_replic.c | 984 +++
90 .../sdk_fman/Peripherals/FM/Pcd/fm_replic.h | 101 +
91 .../sdk_fman/Peripherals/FM/Pcd/fman_kg.c | 888 +++
92 .../sdk_fman/Peripherals/FM/Pcd/fman_prs.c | 129 +
93 .../sdk_fman/Peripherals/FM/Port/Makefile | 15 +
94 .../sdk_fman/Peripherals/FM/Port/fm_port.c | 6436 +++++++++++++++++
95 .../sdk_fman/Peripherals/FM/Port/fm_port.h | 999 +++
96 .../sdk_fman/Peripherals/FM/Port/fm_port_dsar.h | 494 ++
97 .../sdk_fman/Peripherals/FM/Port/fm_port_im.c | 753 ++
98 .../sdk_fman/Peripherals/FM/Port/fman_port.c | 1568 ++++
99 .../freescale/sdk_fman/Peripherals/FM/Rtc/Makefile | 15 +
100 .../freescale/sdk_fman/Peripherals/FM/Rtc/fm_rtc.c | 692 ++
101 .../freescale/sdk_fman/Peripherals/FM/Rtc/fm_rtc.h | 96 +
102 .../sdk_fman/Peripherals/FM/Rtc/fman_rtc.c | 334 +
103 .../freescale/sdk_fman/Peripherals/FM/SP/Makefile | 15 +
104 .../freescale/sdk_fman/Peripherals/FM/SP/fm_sp.c | 757 ++
105 .../freescale/sdk_fman/Peripherals/FM/SP/fm_sp.h | 85 +
106 .../freescale/sdk_fman/Peripherals/FM/SP/fman_sp.c | 197 +
107 .../freescale/sdk_fman/Peripherals/FM/fm.c | 5216 ++++++++++++++
108 .../freescale/sdk_fman/Peripherals/FM/fm.h | 648 ++
109 .../freescale/sdk_fman/Peripherals/FM/fm_ipc.h | 465 ++
110 .../freescale/sdk_fman/Peripherals/FM/fm_muram.c | 174 +
111 .../freescale/sdk_fman/Peripherals/FM/fman.c | 1398 ++++
112 .../sdk_fman/Peripherals/FM/inc/fm_common.h | 1214 ++++
113 .../freescale/sdk_fman/Peripherals/FM/inc/fm_hc.h | 93 +
114 .../sdk_fman/Peripherals/FM/inc/fm_sp_common.h | 117 +
115 .../net/ethernet/freescale/sdk_fman/etc/Makefile | 12 +
116 .../net/ethernet/freescale/sdk_fman/etc/error.c | 95 +
117 drivers/net/ethernet/freescale/sdk_fman/etc/list.c | 71 +
118 .../net/ethernet/freescale/sdk_fman/etc/memcpy.c | 620 ++
119 drivers/net/ethernet/freescale/sdk_fman/etc/mm.c | 1155 +++
120 drivers/net/ethernet/freescale/sdk_fman/etc/mm.h | 105 +
121 .../net/ethernet/freescale/sdk_fman/etc/sprint.c | 81 +
122 .../ethernet/freescale/sdk_fman/fmanv3h_dflags.h | 57 +
123 .../ethernet/freescale/sdk_fman/fmanv3l_dflags.h | 56 +
124 .../sdk_fman/inc/Peripherals/crc_mac_addr_ext.h | 364 +
125 .../freescale/sdk_fman/inc/Peripherals/dpaa_ext.h | 210 +
126 .../freescale/sdk_fman/inc/Peripherals/fm_ext.h | 1731 +++++
127 .../sdk_fman/inc/Peripherals/fm_mac_ext.h | 887 +++
128 .../sdk_fman/inc/Peripherals/fm_macsec_ext.h | 1271 ++++
129 .../sdk_fman/inc/Peripherals/fm_muram_ext.h | 170 +
130 .../sdk_fman/inc/Peripherals/fm_pcd_ext.h | 3974 ++++++++++
131 .../sdk_fman/inc/Peripherals/fm_port_ext.h | 2608 +++++++
132 .../sdk_fman/inc/Peripherals/fm_rtc_ext.h | 619 ++
133 .../sdk_fman/inc/Peripherals/fm_vsp_ext.h | 411 ++
134 .../sdk_fman/inc/Peripherals/mii_acc_ext.h | 76 +
135 .../net/ethernet/freescale/sdk_fman/inc/core_ext.h | 90 +
136 .../freescale/sdk_fman/inc/cores/arm_ext.h | 55 +
137 .../freescale/sdk_fman/inc/cores/e500v2_ext.h | 476 ++
138 .../freescale/sdk_fman/inc/cores/ppc_ext.h | 141 +
139 .../ethernet/freescale/sdk_fman/inc/ddr_std_ext.h | 77 +
140 .../ethernet/freescale/sdk_fman/inc/debug_ext.h | 233 +
141 .../ethernet/freescale/sdk_fman/inc/endian_ext.h | 447 ++
142 .../net/ethernet/freescale/sdk_fman/inc/enet_ext.h | 205 +
143 .../ethernet/freescale/sdk_fman/inc/error_ext.h | 529 ++
144 .../ethernet/freescale/sdk_fman/inc/etc/list_ext.h | 358 +
145 .../ethernet/freescale/sdk_fman/inc/etc/mem_ext.h | 318 +
146 .../freescale/sdk_fman/inc/etc/memcpy_ext.h | 208 +
147 .../ethernet/freescale/sdk_fman/inc/etc/mm_ext.h | 310 +
148 .../freescale/sdk_fman/inc/etc/sprint_ext.h | 118 +
149 .../sdk_fman/inc/flib/common/arch/ppc_access.h | 37 +
150 .../freescale/sdk_fman/inc/flib/common/general.h | 52 +
151 .../freescale/sdk_fman/inc/flib/fman_common.h | 78 +
152 .../freescale/sdk_fman/inc/flib/fsl_enet.h | 273 +
153 .../freescale/sdk_fman/inc/flib/fsl_fman.h | 825 +++
154 .../freescale/sdk_fman/inc/flib/fsl_fman_dtsec.h | 1096 +++
155 .../sdk_fman/inc/flib/fsl_fman_dtsec_mii_acc.h | 107 +
156 .../freescale/sdk_fman/inc/flib/fsl_fman_kg.h | 514 ++
157 .../freescale/sdk_fman/inc/flib/fsl_fman_memac.h | 434 ++
158 .../sdk_fman/inc/flib/fsl_fman_memac_mii_acc.h | 78 +
159 .../freescale/sdk_fman/inc/flib/fsl_fman_port.h | 593 ++
160 .../freescale/sdk_fman/inc/flib/fsl_fman_prs.h | 102 +
161 .../freescale/sdk_fman/inc/flib/fsl_fman_rtc.h | 449 ++
162 .../freescale/sdk_fman/inc/flib/fsl_fman_sp.h | 138 +
163 .../freescale/sdk_fman/inc/flib/fsl_fman_tgec.h | 479 ++
164 .../integrations/FMANV3H/dpaa_integration_ext.h | 291 +
165 .../sdk_fman/inc/integrations/FMANV3H/part_ext.h | 71 +
166 .../integrations/FMANV3H/part_integration_ext.h | 304 +
167 .../integrations/FMANV3L/dpaa_integration_ext.h | 293 +
168 .../sdk_fman/inc/integrations/FMANV3L/part_ext.h | 59 +
169 .../integrations/FMANV3L/part_integration_ext.h | 304 +
170 .../inc/integrations/LS1043/dpaa_integration_ext.h | 291 +
171 .../sdk_fman/inc/integrations/LS1043/part_ext.h | 64 +
172 .../inc/integrations/LS1043/part_integration_ext.h | 185 +
173 .../inc/integrations/P1023/dpaa_integration_ext.h | 213 +
174 .../sdk_fman/inc/integrations/P1023/part_ext.h | 82 +
175 .../inc/integrations/P1023/part_integration_ext.h | 635 ++
176 .../P3040_P4080_P5020/dpaa_integration_ext.h | 276 +
177 .../inc/integrations/P3040_P4080_P5020/part_ext.h | 83 +
178 .../P3040_P4080_P5020/part_integration_ext.h | 336 +
179 .../net/ethernet/freescale/sdk_fman/inc/math_ext.h | 100 +
180 .../net/ethernet/freescale/sdk_fman/inc/ncsw_ext.h | 435 ++
181 .../net/ethernet/freescale/sdk_fman/inc/net_ext.h | 430 ++
182 .../net/ethernet/freescale/sdk_fman/inc/std_ext.h | 48 +
183 .../ethernet/freescale/sdk_fman/inc/stdarg_ext.h | 49 +
184 .../ethernet/freescale/sdk_fman/inc/stdlib_ext.h | 162 +
185 .../ethernet/freescale/sdk_fman/inc/string_ext.h | 56 +
186 .../ethernet/freescale/sdk_fman/inc/types_ext.h | 62 +
187 .../ethernet/freescale/sdk_fman/inc/xx_common.h | 56 +
188 .../net/ethernet/freescale/sdk_fman/inc/xx_ext.h | 791 ++
189 .../ethernet/freescale/sdk_fman/ls1043_dflags.h | 56 +
190 .../net/ethernet/freescale/sdk_fman/ncsw_config.mk | 53 +
191 .../net/ethernet/freescale/sdk_fman/p1023_dflags.h | 65 +
192 .../freescale/sdk_fman/p3040_4080_5020_dflags.h | 62 +
193 .../net/ethernet/freescale/sdk_fman/src/Makefile | 11 +
194 .../freescale/sdk_fman/src/inc/system/sys_ext.h | 118 +
195 .../freescale/sdk_fman/src/inc/system/sys_io_ext.h | 46 +
196 .../freescale/sdk_fman/src/inc/types_linux.h | 208 +
197 .../sdk_fman/src/inc/wrapper/fsl_fman_test.h | 84 +
198 .../sdk_fman/src/inc/wrapper/lnxwrp_exp_sym.h | 130 +
199 .../sdk_fman/src/inc/wrapper/lnxwrp_fm_ext.h | 163 +
200 .../sdk_fman/src/inc/wrapper/lnxwrp_fsl_fman.h | 921 +++
201 .../ethernet/freescale/sdk_fman/src/inc/xx/xx.h | 50 +
202 .../freescale/sdk_fman/src/system/Makefile | 10 +
203 .../freescale/sdk_fman/src/system/sys_io.c | 171 +
204 .../freescale/sdk_fman/src/wrapper/Makefile | 19 +
205 .../freescale/sdk_fman/src/wrapper/fman_test.c | 1665 +++++
206 .../freescale/sdk_fman/src/wrapper/lnxwrp_fm.c | 2908 ++++++++
207 .../freescale/sdk_fman/src/wrapper/lnxwrp_fm.h | 294 +
208 .../sdk_fman/src/wrapper/lnxwrp_fm_port.c | 1480 ++++
209 .../sdk_fman/src/wrapper/lnxwrp_ioctls_fm.c | 4854 +++++++++++++
210 .../sdk_fman/src/wrapper/lnxwrp_ioctls_fm_compat.c | 1297 ++++
211 .../sdk_fman/src/wrapper/lnxwrp_ioctls_fm_compat.h | 755 ++
212 .../sdk_fman/src/wrapper/lnxwrp_resources.h | 121 +
213 .../sdk_fman/src/wrapper/lnxwrp_resources_ut.c | 191 +
214 .../sdk_fman/src/wrapper/lnxwrp_resources_ut.h | 144 +
215 .../sdk_fman/src/wrapper/lnxwrp_resources_ut.make | 28 +
216 .../freescale/sdk_fman/src/wrapper/lnxwrp_sysfs.c | 60 +
217 .../freescale/sdk_fman/src/wrapper/lnxwrp_sysfs.h | 60 +
218 .../sdk_fman/src/wrapper/lnxwrp_sysfs_fm.c | 1855 +++++
219 .../sdk_fman/src/wrapper/lnxwrp_sysfs_fm.h | 136 +
220 .../sdk_fman/src/wrapper/lnxwrp_sysfs_fm_port.c | 1268 ++++
221 .../sdk_fman/src/wrapper/lnxwrp_sysfs_fm_port.h | 56 +
222 .../ethernet/freescale/sdk_fman/src/xx/Makefile | 18 +
223 .../freescale/sdk_fman/src/xx/module_strings.c | 46 +
224 .../freescale/sdk_fman/src/xx/xx_arm_linux.c | 905 +++
225 .../ethernet/freescale/sdk_fman/src/xx/xx_linux.c | 918 +++
226 drivers/staging/fsl_qbman/Kconfig | 228 +
227 drivers/staging/fsl_qbman/Makefile | 28 +
228 drivers/staging/fsl_qbman/bman_config.c | 720 ++
229 drivers/staging/fsl_qbman/bman_debugfs.c | 119 +
230 drivers/staging/fsl_qbman/bman_driver.c | 575 ++
231 drivers/staging/fsl_qbman/bman_high.c | 1145 +++
232 drivers/staging/fsl_qbman/bman_low.h | 565 ++
233 drivers/staging/fsl_qbman/bman_private.h | 166 +
234 drivers/staging/fsl_qbman/bman_test.c | 56 +
235 drivers/staging/fsl_qbman/bman_test.h | 44 +
236 drivers/staging/fsl_qbman/bman_test_high.c | 183 +
237 drivers/staging/fsl_qbman/bman_test_thresh.c | 196 +
238 drivers/staging/fsl_qbman/dpa_alloc.c | 706 ++
239 drivers/staging/fsl_qbman/dpa_sys.h | 259 +
240 drivers/staging/fsl_qbman/dpa_sys_arm.h | 95 +
241 drivers/staging/fsl_qbman/dpa_sys_arm64.h | 102 +
242 drivers/staging/fsl_qbman/dpa_sys_ppc32.h | 70 +
243 drivers/staging/fsl_qbman/dpa_sys_ppc64.h | 79 +
244 drivers/staging/fsl_qbman/fsl_usdpaa.c | 1983 +++++
245 drivers/staging/fsl_qbman/fsl_usdpaa_irq.c | 289 +
246 drivers/staging/fsl_qbman/qbman_driver.c | 88 +
247 drivers/staging/fsl_qbman/qman_config.c | 1224 ++++
248 drivers/staging/fsl_qbman/qman_debugfs.c | 1594 ++++
249 drivers/staging/fsl_qbman/qman_driver.c | 977 +++
250 drivers/staging/fsl_qbman/qman_high.c | 5669 +++++++++++++++
251 drivers/staging/fsl_qbman/qman_low.h | 1427 ++++
252 drivers/staging/fsl_qbman/qman_private.h | 398 +
253 drivers/staging/fsl_qbman/qman_test.c | 57 +
254 drivers/staging/fsl_qbman/qman_test.h | 45 +
255 drivers/staging/fsl_qbman/qman_test_high.c | 216 +
256 drivers/staging/fsl_qbman/qman_test_hotpotato.c | 502 ++
257 drivers/staging/fsl_qbman/qman_utility.c | 129 +
258 include/linux/fsl_bman.h | 532 ++
259 include/linux/fsl_qman.h | 3888 ++++++++++
260 include/linux/fsl_usdpaa.h | 372 +
261 include/uapi/linux/fmd/Kbuild | 5 +
262 include/uapi/linux/fmd/Peripherals/Kbuild | 4 +
263 include/uapi/linux/fmd/Peripherals/fm_ioctls.h | 628 ++
264 include/uapi/linux/fmd/Peripherals/fm_pcd_ioctls.h | 3084 ++++++++
265 .../uapi/linux/fmd/Peripherals/fm_port_ioctls.h | 973 +++
266 .../uapi/linux/fmd/Peripherals/fm_test_ioctls.h | 208 +
267 include/uapi/linux/fmd/integrations/Kbuild | 1 +
268 .../linux/fmd/integrations/integration_ioctls.h | 56 +
269 include/uapi/linux/fmd/ioctls.h | 96 +
270 include/uapi/linux/fmd/net_ioctls.h | 430 ++
271 257 files changed, 153159 insertions(+)
272 create mode 100644 drivers/net/ethernet/freescale/sdk_dpaa/Kconfig
273 create mode 100644 drivers/net/ethernet/freescale/sdk_dpaa/Makefile
274 create mode 100644 drivers/net/ethernet/freescale/sdk_dpaa/dpaa_1588.c
275 create mode 100644 drivers/net/ethernet/freescale/sdk_dpaa/dpaa_1588.h
276 create mode 100644 drivers/net/ethernet/freescale/sdk_dpaa/dpaa_debugfs.c
277 create mode 100644 drivers/net/ethernet/freescale/sdk_dpaa/dpaa_debugfs.h
278 create mode 100644 drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth.c
279 create mode 100644 drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth.h
280 create mode 100644 drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_base.c
281 create mode 100644 drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_base.h
282 create mode 100644 drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_ceetm.c
283 create mode 100644 drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_ceetm.h
284 create mode 100644 drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_common.c
285 create mode 100644 drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_common.h
286 create mode 100644 drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_proxy.c
287 create mode 100644 drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_sg.c
288 create mode 100644 drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_sysfs.c
289 create mode 100644 drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_trace.h
290 create mode 100644 drivers/net/ethernet/freescale/sdk_dpaa/dpaa_ethtool.c
291 create mode 100644 drivers/net/ethernet/freescale/sdk_dpaa/dpaa_ptp.c
292 create mode 100644 drivers/net/ethernet/freescale/sdk_dpaa/mac-api.c
293 create mode 100644 drivers/net/ethernet/freescale/sdk_dpaa/mac.c
294 create mode 100644 drivers/net/ethernet/freescale/sdk_dpaa/mac.h
295 create mode 100644 drivers/net/ethernet/freescale/sdk_dpaa/offline_port.c
296 create mode 100644 drivers/net/ethernet/freescale/sdk_dpaa/offline_port.h
297 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Kconfig
298 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Makefile
299 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/HC/Makefile
300 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/HC/hc.c
301 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/MAC/Makefile
302 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/MAC/dtsec.c
303 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/MAC/dtsec.h
304 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/MAC/dtsec_mii_acc.c
305 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/MAC/dtsec_mii_acc.h
306 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/MAC/fm_mac.c
307 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/MAC/fm_mac.h
308 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/MAC/fman_crc32.c
309 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/MAC/fman_crc32.h
310 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/MAC/fman_dtsec.c
311 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/MAC/fman_dtsec_mii_acc.c
312 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/MAC/fman_memac.c
313 create mode 100755 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/MAC/fman_memac_mii_acc.c
314 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/MAC/fman_tgec.c
315 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/MAC/memac.c
316 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/MAC/memac.h
317 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/MAC/memac_mii_acc.c
318 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/MAC/memac_mii_acc.h
319 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/MAC/tgec.c
320 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/MAC/tgec.h
321 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/MAC/tgec_mii_acc.c
322 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/MAC/tgec_mii_acc.h
323 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/MACSEC/Makefile
324 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/MACSEC/fm_macsec.c
325 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/MACSEC/fm_macsec.h
326 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/MACSEC/fm_macsec_guest.c
327 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/MACSEC/fm_macsec_master.c
328 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/MACSEC/fm_macsec_master.h
329 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/MACSEC/fm_macsec_secy.c
330 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/MACSEC/fm_macsec_secy.h
331 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Makefile
332 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Pcd/Makefile
333 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Pcd/crc64.h
334 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Pcd/fm_cc.c
335 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Pcd/fm_cc.h
336 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Pcd/fm_kg.c
337 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Pcd/fm_kg.h
338 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Pcd/fm_manip.c
339 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Pcd/fm_manip.h
340 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Pcd/fm_pcd.c
341 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Pcd/fm_pcd.h
342 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Pcd/fm_pcd_ipc.h
343 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Pcd/fm_plcr.c
344 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Pcd/fm_plcr.h
345 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Pcd/fm_prs.c
346 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Pcd/fm_prs.h
347 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Pcd/fm_replic.c
348 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Pcd/fm_replic.h
349 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Pcd/fman_kg.c
350 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Pcd/fman_prs.c
351 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Port/Makefile
352 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Port/fm_port.c
353 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Port/fm_port.h
354 create mode 100755 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Port/fm_port_dsar.h
355 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Port/fm_port_im.c
356 create mode 100755 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Port/fman_port.c
357 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Rtc/Makefile
358 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Rtc/fm_rtc.c
359 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Rtc/fm_rtc.h
360 create mode 100755 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Rtc/fman_rtc.c
361 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/SP/Makefile
362 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/SP/fm_sp.c
363 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/SP/fm_sp.h
364 create mode 100755 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/SP/fman_sp.c
365 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/fm.c
366 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/fm.h
367 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/fm_ipc.h
368 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/fm_muram.c
369 create mode 100755 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/fman.c
370 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/inc/fm_common.h
371 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/inc/fm_hc.h
372 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/inc/fm_sp_common.h
373 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/etc/Makefile
374 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/etc/error.c
375 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/etc/list.c
376 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/etc/memcpy.c
377 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/etc/mm.c
378 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/etc/mm.h
379 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/etc/sprint.c
380 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/fmanv3h_dflags.h
381 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/fmanv3l_dflags.h
382 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/Peripherals/crc_mac_addr_ext.h
383 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/Peripherals/dpaa_ext.h
384 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/Peripherals/fm_ext.h
385 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/Peripherals/fm_mac_ext.h
386 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/Peripherals/fm_macsec_ext.h
387 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/Peripherals/fm_muram_ext.h
388 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/Peripherals/fm_pcd_ext.h
389 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/Peripherals/fm_port_ext.h
390 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/Peripherals/fm_rtc_ext.h
391 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/Peripherals/fm_vsp_ext.h
392 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/Peripherals/mii_acc_ext.h
393 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/core_ext.h
394 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/cores/arm_ext.h
395 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/cores/e500v2_ext.h
396 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/cores/ppc_ext.h
397 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/ddr_std_ext.h
398 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/debug_ext.h
399 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/endian_ext.h
400 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/enet_ext.h
401 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/error_ext.h
402 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/etc/list_ext.h
403 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/etc/mem_ext.h
404 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/etc/memcpy_ext.h
405 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/etc/mm_ext.h
406 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/etc/sprint_ext.h
407 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/flib/common/arch/ppc_access.h
408 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/flib/common/general.h
409 create mode 100755 drivers/net/ethernet/freescale/sdk_fman/inc/flib/fman_common.h
410 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/flib/fsl_enet.h
411 create mode 100755 drivers/net/ethernet/freescale/sdk_fman/inc/flib/fsl_fman.h
412 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/flib/fsl_fman_dtsec.h
413 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/flib/fsl_fman_dtsec_mii_acc.h
414 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/flib/fsl_fman_kg.h
415 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/flib/fsl_fman_memac.h
416 create mode 100755 drivers/net/ethernet/freescale/sdk_fman/inc/flib/fsl_fman_memac_mii_acc.h
417 create mode 100755 drivers/net/ethernet/freescale/sdk_fman/inc/flib/fsl_fman_port.h
418 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/flib/fsl_fman_prs.h
419 create mode 100755 drivers/net/ethernet/freescale/sdk_fman/inc/flib/fsl_fman_rtc.h
420 create mode 100755 drivers/net/ethernet/freescale/sdk_fman/inc/flib/fsl_fman_sp.h
421 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/flib/fsl_fman_tgec.h
422 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/integrations/FMANV3H/dpaa_integration_ext.h
423 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/integrations/FMANV3H/part_ext.h
424 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/integrations/FMANV3H/part_integration_ext.h
425 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/integrations/FMANV3L/dpaa_integration_ext.h
426 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/integrations/FMANV3L/part_ext.h
427 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/integrations/FMANV3L/part_integration_ext.h
428 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/integrations/LS1043/dpaa_integration_ext.h
429 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/integrations/LS1043/part_ext.h
430 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/integrations/LS1043/part_integration_ext.h
431 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/integrations/P1023/dpaa_integration_ext.h
432 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/integrations/P1023/part_ext.h
433 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/integrations/P1023/part_integration_ext.h
434 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/integrations/P3040_P4080_P5020/dpaa_integration_ext.h
435 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/integrations/P3040_P4080_P5020/part_ext.h
436 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/integrations/P3040_P4080_P5020/part_integration_ext.h
437 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/math_ext.h
438 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/ncsw_ext.h
439 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/net_ext.h
440 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/std_ext.h
441 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/stdarg_ext.h
442 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/stdlib_ext.h
443 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/string_ext.h
444 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/types_ext.h
445 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/xx_common.h
446 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/inc/xx_ext.h
447 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/ls1043_dflags.h
448 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/ncsw_config.mk
449 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/p1023_dflags.h
450 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/p3040_4080_5020_dflags.h
451 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/src/Makefile
452 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/src/inc/system/sys_ext.h
453 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/src/inc/system/sys_io_ext.h
454 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/src/inc/types_linux.h
455 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/src/inc/wrapper/fsl_fman_test.h
456 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/src/inc/wrapper/lnxwrp_exp_sym.h
457 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/src/inc/wrapper/lnxwrp_fm_ext.h
458 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/src/inc/wrapper/lnxwrp_fsl_fman.h
459 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/src/inc/xx/xx.h
460 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/src/system/Makefile
461 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/src/system/sys_io.c
462 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/src/wrapper/Makefile
463 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/src/wrapper/fman_test.c
464 create mode 100755 drivers/net/ethernet/freescale/sdk_fman/src/wrapper/lnxwrp_fm.c
465 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/src/wrapper/lnxwrp_fm.h
466 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/src/wrapper/lnxwrp_fm_port.c
467 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/src/wrapper/lnxwrp_ioctls_fm.c
468 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/src/wrapper/lnxwrp_ioctls_fm_compat.c
469 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/src/wrapper/lnxwrp_ioctls_fm_compat.h
470 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/src/wrapper/lnxwrp_resources.h
471 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/src/wrapper/lnxwrp_resources_ut.c
472 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/src/wrapper/lnxwrp_resources_ut.h
473 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/src/wrapper/lnxwrp_resources_ut.make
474 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/src/wrapper/lnxwrp_sysfs.c
475 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/src/wrapper/lnxwrp_sysfs.h
476 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/src/wrapper/lnxwrp_sysfs_fm.c
477 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/src/wrapper/lnxwrp_sysfs_fm.h
478 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/src/wrapper/lnxwrp_sysfs_fm_port.c
479 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/src/wrapper/lnxwrp_sysfs_fm_port.h
480 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/src/xx/Makefile
481 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/src/xx/module_strings.c
482 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/src/xx/xx_arm_linux.c
483 create mode 100644 drivers/net/ethernet/freescale/sdk_fman/src/xx/xx_linux.c
484 create mode 100644 drivers/staging/fsl_qbman/Kconfig
485 create mode 100644 drivers/staging/fsl_qbman/Makefile
486 create mode 100644 drivers/staging/fsl_qbman/bman_config.c
487 create mode 100644 drivers/staging/fsl_qbman/bman_debugfs.c
488 create mode 100644 drivers/staging/fsl_qbman/bman_driver.c
489 create mode 100644 drivers/staging/fsl_qbman/bman_high.c
490 create mode 100644 drivers/staging/fsl_qbman/bman_low.h
491 create mode 100644 drivers/staging/fsl_qbman/bman_private.h
492 create mode 100644 drivers/staging/fsl_qbman/bman_test.c
493 create mode 100644 drivers/staging/fsl_qbman/bman_test.h
494 create mode 100644 drivers/staging/fsl_qbman/bman_test_high.c
495 create mode 100644 drivers/staging/fsl_qbman/bman_test_thresh.c
496 create mode 100644 drivers/staging/fsl_qbman/dpa_alloc.c
497 create mode 100644 drivers/staging/fsl_qbman/dpa_sys.h
498 create mode 100644 drivers/staging/fsl_qbman/dpa_sys_arm.h
499 create mode 100644 drivers/staging/fsl_qbman/dpa_sys_arm64.h
500 create mode 100644 drivers/staging/fsl_qbman/dpa_sys_ppc32.h
501 create mode 100644 drivers/staging/fsl_qbman/dpa_sys_ppc64.h
502 create mode 100644 drivers/staging/fsl_qbman/fsl_usdpaa.c
503 create mode 100644 drivers/staging/fsl_qbman/fsl_usdpaa_irq.c
504 create mode 100644 drivers/staging/fsl_qbman/qbman_driver.c
505 create mode 100644 drivers/staging/fsl_qbman/qman_config.c
506 create mode 100644 drivers/staging/fsl_qbman/qman_debugfs.c
507 create mode 100644 drivers/staging/fsl_qbman/qman_driver.c
508 create mode 100644 drivers/staging/fsl_qbman/qman_high.c
509 create mode 100644 drivers/staging/fsl_qbman/qman_low.h
510 create mode 100644 drivers/staging/fsl_qbman/qman_private.h
511 create mode 100644 drivers/staging/fsl_qbman/qman_test.c
512 create mode 100644 drivers/staging/fsl_qbman/qman_test.h
513 create mode 100644 drivers/staging/fsl_qbman/qman_test_high.c
514 create mode 100644 drivers/staging/fsl_qbman/qman_test_hotpotato.c
515 create mode 100644 drivers/staging/fsl_qbman/qman_utility.c
516 create mode 100644 include/linux/fsl_bman.h
517 create mode 100644 include/linux/fsl_qman.h
518 create mode 100644 include/linux/fsl_usdpaa.h
519 create mode 100644 include/uapi/linux/fmd/Kbuild
520 create mode 100644 include/uapi/linux/fmd/Peripherals/Kbuild
521 create mode 100644 include/uapi/linux/fmd/Peripherals/fm_ioctls.h
522 create mode 100644 include/uapi/linux/fmd/Peripherals/fm_pcd_ioctls.h
523 create mode 100644 include/uapi/linux/fmd/Peripherals/fm_port_ioctls.h
524 create mode 100644 include/uapi/linux/fmd/Peripherals/fm_test_ioctls.h
525 create mode 100644 include/uapi/linux/fmd/integrations/Kbuild
526 create mode 100644 include/uapi/linux/fmd/integrations/integration_ioctls.h
527 create mode 100644 include/uapi/linux/fmd/ioctls.h
528 create mode 100644 include/uapi/linux/fmd/net_ioctls.h
529
530 --- /dev/null
531 +++ b/drivers/net/ethernet/freescale/sdk_dpaa/Kconfig
532 @@ -0,0 +1,173 @@
533 +menuconfig FSL_SDK_DPAA_ETH
534 + tristate "DPAA Ethernet"
535 + depends on (FSL_SOC || ARM64 || ARM) && FSL_SDK_BMAN && FSL_SDK_QMAN && FSL_SDK_FMAN && !FSL_DPAA_ETH
536 + select PHYLIB
537 + help
538 + Data Path Acceleration Architecture Ethernet driver,
539 + supporting the Freescale QorIQ chips.
540 + Depends on Freescale Buffer Manager and Queue Manager
541 + driver and Frame Manager Driver.
542 +
543 +if FSL_SDK_DPAA_ETH
544 +
545 +config FSL_DPAA_HOOKS
546 + bool "DPAA Ethernet driver hooks"
547 +
548 +config FSL_DPAA_CEETM
549 + bool "DPAA CEETM QoS"
550 + depends on NET_SCHED
551 + default n
552 + help
553 + Enable QoS offloading support through the CEETM hardware block.
554 +
555 +config FSL_DPAA_OFFLINE_PORTS
556 + bool "Offline Ports support"
557 + depends on FSL_SDK_DPAA_ETH
558 + default y
559 + help
560 + The Offline Parsing / Host Command ports (short: OH ports, of Offline ports) provide
561 + most of the functionality of the regular, online ports, except they receive their
562 + frames from a core or an accelerator on the SoC, via QMan frame queues,
563 + rather than directly from the network.
564 + Offline ports are configured via PCD (Parse-Classify-Distribute) schemes, just like
565 + any online FMan port. They deliver the processed frames to frame queues, according
566 + to the applied PCD configurations.
567 +
568 + Choosing this feature will not impact the functionality and/or performance of the system,
569 + so it is safe to have it.
570 +
571 +config FSL_DPAA_ADVANCED_DRIVERS
572 + bool "Advanced DPAA Ethernet drivers"
573 + depends on FSL_SDK_DPAA_ETH
574 + default y
575 + help
576 + Besides the standard DPAA Ethernet driver the DPAA Proxy initialization driver
577 + is needed to support advanced scenarios. Select this to also build the advanced
578 + drivers.
579 +
580 +config FSL_DPAA_ETH_JUMBO_FRAME
581 + bool "Optimize for jumbo frames"
582 + default n
583 + help
584 + Optimize the DPAA Ethernet driver throughput for large frames
585 + termination traffic (e.g. 4K and above).
586 + NOTE: This option can only be used if FSL_FM_MAX_FRAME_SIZE
587 + is set to 9600 bytes.
588 + Using this option in combination with small frames increases
589 + significantly the driver's memory footprint and may even deplete
590 + the system memory. Also, the skb truesize is altered and messages
591 + from the stack that warn against this are bypassed.
592 + This option is not available on LS1043.
593 +
594 +config FSL_DPAA_TS
595 + bool "Linux compliant timestamping"
596 + depends on FSL_SDK_DPAA_ETH
597 + default n
598 + help
599 + Enable Linux API compliant timestamping support.
600 +
601 +config FSL_DPAA_1588
602 + bool "IEEE 1588-compliant timestamping"
603 + depends on FSL_SDK_DPAA_ETH
604 + select FSL_DPAA_TS
605 + default n
606 + help
607 + Enable IEEE1588 support code.
608 +
609 +config FSL_DPAA_ETH_USE_NDO_SELECT_QUEUE
610 + bool "Use driver's Tx queue selection mechanism"
611 + default y
612 + depends on FSL_SDK_DPAA_ETH
613 + help
614 + The DPAA-Ethernet driver defines a ndo_select_queue() callback for optimal selection
615 + of the egress FQ. That will override the XPS support for this netdevice.
616 + If for whatever reason you want to be in control of the egress FQ-to-CPU selection and mapping,
617 + or simply don't want to use the driver's ndo_select_queue() callback, then unselect this
618 + and use the standard XPS support instead.
619 +
620 +config FSL_DPAA_ETH_MAX_BUF_COUNT
621 + int "Maximum nuber of buffers in private bpool"
622 + depends on FSL_SDK_DPAA_ETH
623 + range 64 2048
624 + default "128"
625 + help
626 + The maximum number of buffers to be by default allocated in the DPAA-Ethernet private port's
627 + buffer pool. One needn't normally modify this, as it has probably been tuned for performance
628 + already. This cannot be lower than DPAA_ETH_REFILL_THRESHOLD.
629 +
630 +config FSL_DPAA_ETH_REFILL_THRESHOLD
631 + int "Private bpool refill threshold"
632 + depends on FSL_SDK_DPAA_ETH
633 + range 32 FSL_DPAA_ETH_MAX_BUF_COUNT
634 + default "80"
635 + help
636 + The DPAA-Ethernet driver will start replenishing buffer pools whose count
637 + falls below this threshold. This must be related to DPAA_ETH_MAX_BUF_COUNT. One needn't normally
638 + modify this value unless one has very specific performance reasons.
639 +
640 +config FSL_DPAA_CS_THRESHOLD_1G
641 + hex "Egress congestion threshold on 1G ports"
642 + depends on FSL_SDK_DPAA_ETH
643 + range 0x1000 0x10000000
644 + default "0x06000000"
645 + help
646 + The size in bytes of the egress Congestion State notification threshold on 1G ports.
647 + The 1G dTSECs can quite easily be flooded by cores doing Tx in a tight loop
648 + (e.g. by sending UDP datagrams at "while(1) speed"),
649 + and the larger the frame size, the more acute the problem.
650 + So we have to find a balance between these factors:
651 + - avoiding the device staying congested for a prolonged time (risking
652 + the netdev watchdog to fire - see also the tx_timeout module param);
653 + - affecting performance of protocols such as TCP, which otherwise
654 + behave well under the congestion notification mechanism;
655 + - preventing the Tx cores from tightly-looping (as if the congestion
656 + threshold was too low to be effective);
657 + - running out of memory if the CS threshold is set too high.
658 +
659 +config FSL_DPAA_CS_THRESHOLD_10G
660 + hex "Egress congestion threshold on 10G ports"
661 + depends on FSL_SDK_DPAA_ETH
662 + range 0x1000 0x20000000
663 + default "0x10000000"
664 + help
665 + The size in bytes of the egress Congestion State notification threshold on 10G ports.
666 +
667 +config FSL_DPAA_INGRESS_CS_THRESHOLD
668 + hex "Ingress congestion threshold on FMan ports"
669 + depends on FSL_SDK_DPAA_ETH
670 + default "0x10000000"
671 + help
672 + The size in bytes of the ingress tail-drop threshold on FMan ports.
673 + Traffic piling up above this value will be rejected by QMan and discarded by FMan.
674 +
675 +config FSL_DPAA_ETH_DEBUGFS
676 + bool "DPAA Ethernet debugfs interface"
677 + depends on DEBUG_FS && FSL_SDK_DPAA_ETH
678 + default y
679 + help
680 + This option compiles debugfs code for the DPAA Ethernet driver.
681 +
682 +config FSL_DPAA_ETH_DEBUG
683 + bool "DPAA Ethernet Debug Support"
684 + depends on FSL_SDK_DPAA_ETH
685 + default n
686 + help
687 + This option compiles debug code for the DPAA Ethernet driver.
688 +
689 +config FSL_DPAA_DBG_LOOP
690 + bool "DPAA Ethernet Debug loopback"
691 + depends on FSL_DPAA_ETH_DEBUGFS && FSL_DPAA_ETH_USE_NDO_SELECT_QUEUE
692 + default n
693 + help
694 + This option allows to divert all received traffic on a certain interface A towards a
695 + selected interface B. This option is used to benchmark the HW + Ethernet driver in
696 + isolation from the Linux networking stack. The loops are controlled by debugfs entries,
697 + one for each interface. By default all loops are disabled (target value is -1). I.e. to
698 + change the loop setting for interface 4 and divert all received traffic to interface 5
699 + write Tx interface number in the receive interface debugfs file:
700 + # cat /sys/kernel/debug/powerpc/fsl_dpa/eth4_loop
701 + 4->-1
702 + # echo 5 > /sys/kernel/debug/powerpc/fsl_dpa/eth4_loop
703 + # cat /sys/kernel/debug/powerpc/fsl_dpa/eth4_loop
704 + 4->5
705 +endif # FSL_SDK_DPAA_ETH
706 --- /dev/null
707 +++ b/drivers/net/ethernet/freescale/sdk_dpaa/Makefile
708 @@ -0,0 +1,46 @@
709 +#
710 +# Makefile for the Freescale Ethernet controllers
711 +#
712 +ccflags-y += -DVERSION=\"\"
713 +#
714 +# Include netcomm SW specific definitions
715 +include $(srctree)/drivers/net/ethernet/freescale/sdk_fman/ncsw_config.mk
716 +
717 +ccflags-y += -I$(NET_DPA)
718 +
719 +obj-$(CONFIG_FSL_SDK_DPAA_ETH) += fsl_mac.o fsl_dpa.o
720 +obj-$(CONFIG_PTP_1588_CLOCK_DPAA) += dpaa_ptp.o
721 +
722 +fsl_dpa-objs += dpaa_ethtool.o dpaa_eth_sysfs.o dpaa_eth.o dpaa_eth_sg.o dpaa_eth_common.o
723 +ifeq ($(CONFIG_FSL_DPAA_DBG_LOOP),y)
724 +fsl_dpa-objs += dpaa_debugfs.o
725 +endif
726 +ifeq ($(CONFIG_FSL_DPAA_1588),y)
727 +fsl_dpa-objs += dpaa_1588.o
728 +endif
729 +ifeq ($(CONFIG_FSL_DPAA_CEETM),y)
730 +ccflags-y += -Idrivers/net/ethernet/freescale/sdk_fman/src/wrapper
731 +fsl_dpa-objs += dpaa_eth_ceetm.o
732 +endif
733 +
734 +fsl_mac-objs += mac.o mac-api.o
735 +
736 +# Advanced drivers
737 +ifeq ($(CONFIG_FSL_DPAA_ADVANCED_DRIVERS),y)
738 +obj-$(CONFIG_FSL_SDK_DPAA_ETH) += fsl_advanced.o
739 +obj-$(CONFIG_FSL_SDK_DPAA_ETH) += fsl_proxy.o
740 +
741 +fsl_advanced-objs += dpaa_eth_base.o
742 +# suport for multiple drivers per kernel module comes in kernel 3.14
743 +# so we are forced to generate several modules for the advanced drivers
744 +fsl_proxy-objs += dpaa_eth_proxy.o
745 +
746 +ifeq ($(CONFIG_FSL_DPAA_OFFLINE_PORTS),y)
747 +obj-$(CONFIG_FSL_SDK_DPAA_ETH) += fsl_oh.o
748 +
749 +fsl_oh-objs += offline_port.o
750 +endif
751 +endif
752 +
753 +# Needed by the tracing framework
754 +CFLAGS_dpaa_eth.o := -I$(src)
755 --- /dev/null
756 +++ b/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_1588.c
757 @@ -0,0 +1,580 @@
758 +/* Copyright (C) 2011 Freescale Semiconductor, Inc.
759 + * Copyright (C) 2009 IXXAT Automation, GmbH
760 + *
761 + * DPAA Ethernet Driver -- IEEE 1588 interface functionality
762 + *
763 + * This program is free software; you can redistribute it and/or modify
764 + * it under the terms of the GNU General Public License as published by
765 + * the Free Software Foundation; either version 2 of the License, or
766 + * (at your option) any later version.
767 + *
768 + * This program is distributed in the hope that it will be useful,
769 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
770 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
771 + * GNU General Public License for more details.
772 + *
773 + * You should have received a copy of the GNU General Public License along
774 + * with this program; if not, write to the Free Software Foundation, Inc.,
775 + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
776 + *
777 + */
778 +#include <linux/io.h>
779 +#include <linux/device.h>
780 +#include <linux/fs.h>
781 +#include <linux/vmalloc.h>
782 +#include <linux/spinlock.h>
783 +#include <linux/ip.h>
784 +#include <linux/ipv6.h>
785 +#include <linux/udp.h>
786 +#include <asm/div64.h>
787 +#include "dpaa_eth.h"
788 +#include "dpaa_eth_common.h"
789 +#include "dpaa_1588.h"
790 +#include "mac.h"
791 +
792 +static int dpa_ptp_init_circ(struct dpa_ptp_circ_buf *ptp_buf, u32 size)
793 +{
794 + struct circ_buf *circ_buf = &ptp_buf->circ_buf;
795 +
796 + circ_buf->buf = vmalloc(sizeof(struct dpa_ptp_data) * size);
797 + if (!circ_buf->buf)
798 + return 1;
799 +
800 + circ_buf->head = 0;
801 + circ_buf->tail = 0;
802 + ptp_buf->size = size;
803 + spin_lock_init(&ptp_buf->ptp_lock);
804 +
805 + return 0;
806 +}
807 +
808 +static void dpa_ptp_reset_circ(struct dpa_ptp_circ_buf *ptp_buf, u32 size)
809 +{
810 + struct circ_buf *circ_buf = &ptp_buf->circ_buf;
811 +
812 + circ_buf->head = 0;
813 + circ_buf->tail = 0;
814 + ptp_buf->size = size;
815 +}
816 +
817 +static int dpa_ptp_insert(struct dpa_ptp_circ_buf *ptp_buf,
818 + struct dpa_ptp_data *data)
819 +{
820 + struct circ_buf *circ_buf = &ptp_buf->circ_buf;
821 + int size = ptp_buf->size;
822 + struct dpa_ptp_data *tmp;
823 + unsigned long flags;
824 + int head, tail;
825 +
826 + spin_lock_irqsave(&ptp_buf->ptp_lock, flags);
827 +
828 + head = circ_buf->head;
829 + tail = circ_buf->tail;
830 +
831 + if (CIRC_SPACE(head, tail, size) <= 0)
832 + circ_buf->tail = (tail + 1) & (size - 1);
833 +
834 + tmp = (struct dpa_ptp_data *)(circ_buf->buf) + head;
835 + memcpy(tmp, data, sizeof(struct dpa_ptp_data));
836 +
837 + circ_buf->head = (head + 1) & (size - 1);
838 +
839 + spin_unlock_irqrestore(&ptp_buf->ptp_lock, flags);
840 +
841 + return 0;
842 +}
843 +
844 +static int dpa_ptp_is_ident_match(struct dpa_ptp_ident *dst,
845 + struct dpa_ptp_ident *src)
846 +{
847 + int ret;
848 +
849 + if ((dst->version != src->version) || (dst->msg_type != src->msg_type))
850 + return 0;
851 +
852 + if ((dst->netw_prot == src->netw_prot)
853 + || src->netw_prot == DPA_PTP_PROT_DONTCARE) {
854 + if (dst->seq_id != src->seq_id)
855 + return 0;
856 +
857 + ret = memcmp(dst->snd_port_id, src->snd_port_id,
858 + DPA_PTP_SOURCE_PORT_LENGTH);
859 + if (ret)
860 + return 0;
861 + else
862 + return 1;
863 + }
864 +
865 + return 0;
866 +}
867 +
868 +static int dpa_ptp_find_and_remove(struct dpa_ptp_circ_buf *ptp_buf,
869 + struct dpa_ptp_ident *ident,
870 + struct dpa_ptp_time *ts)
871 +{
872 + struct circ_buf *circ_buf = &ptp_buf->circ_buf;
873 + int size = ptp_buf->size;
874 + int head, tail, idx;
875 + unsigned long flags;
876 + struct dpa_ptp_data *tmp, *tmp2;
877 + struct dpa_ptp_ident *tmp_ident;
878 +
879 + spin_lock_irqsave(&ptp_buf->ptp_lock, flags);
880 +
881 + head = circ_buf->head;
882 + tail = idx = circ_buf->tail;
883 +
884 + if (CIRC_CNT(head, tail, size) == 0) {
885 + spin_unlock_irqrestore(&ptp_buf->ptp_lock, flags);
886 + return 1;
887 + }
888 +
889 + while (idx != head) {
890 + tmp = (struct dpa_ptp_data *)(circ_buf->buf) + idx;
891 + tmp_ident = &tmp->ident;
892 + if (dpa_ptp_is_ident_match(tmp_ident, ident))
893 + break;
894 + idx = (idx + 1) & (size - 1);
895 + }
896 +
897 + if (idx == head) {
898 + spin_unlock_irqrestore(&ptp_buf->ptp_lock, flags);
899 + return 1;
900 + }
901 +
902 + ts->sec = tmp->ts.sec;
903 + ts->nsec = tmp->ts.nsec;
904 +
905 + if (idx != tail) {
906 + if (CIRC_CNT(idx, tail, size) > TS_ACCUMULATION_THRESHOLD) {
907 + tail = circ_buf->tail =
908 + (idx - TS_ACCUMULATION_THRESHOLD) & (size - 1);
909 + }
910 +
911 + while (CIRC_CNT(idx, tail, size) > 0) {
912 + tmp = (struct dpa_ptp_data *)(circ_buf->buf) + idx;
913 + idx = (idx - 1) & (size - 1);
914 + tmp2 = (struct dpa_ptp_data *)(circ_buf->buf) + idx;
915 + *tmp = *tmp2;
916 + }
917 + }
918 + circ_buf->tail = (tail + 1) & (size - 1);
919 +
920 + spin_unlock_irqrestore(&ptp_buf->ptp_lock, flags);
921 +
922 + return 0;
923 +}
924 +
925 +/* Parse the PTP packets
926 + *
927 + * The PTP header can be found in an IPv4 packet, IPv6 patcket or in
928 + * an IEEE802.3 ethernet frame. This function returns the position of
929 + * the PTP packet or NULL if no PTP found
930 + */
931 +static u8 *dpa_ptp_parse_packet(struct sk_buff *skb, u16 *eth_type)
932 +{
933 + u8 *pos = skb->data + ETH_ALEN + ETH_ALEN;
934 + u8 *ptp_loc = NULL;
935 + u8 msg_type;
936 + u32 access_len = ETH_ALEN + ETH_ALEN + DPA_ETYPE_LEN;
937 + struct iphdr *iph;
938 + struct udphdr *udph;
939 + struct ipv6hdr *ipv6h;
940 +
941 + /* when we can receive S/G frames we need to check the data we want to
942 + * access is in the linear skb buffer
943 + */
944 + if (!pskb_may_pull(skb, access_len))
945 + return NULL;
946 +
947 + *eth_type = *((u16 *)pos);
948 +
949 + /* Check if inner tag is here */
950 + if (*eth_type == ETH_P_8021Q) {
951 + access_len += DPA_VLAN_TAG_LEN;
952 +
953 + if (!pskb_may_pull(skb, access_len))
954 + return NULL;
955 +
956 + pos += DPA_VLAN_TAG_LEN;
957 + *eth_type = *((u16 *)pos);
958 + }
959 +
960 + pos += DPA_ETYPE_LEN;
961 +
962 + switch (*eth_type) {
963 + /* Transport of PTP over Ethernet */
964 + case ETH_P_1588:
965 + ptp_loc = pos;
966 +
967 + if (!pskb_may_pull(skb, access_len + PTP_OFFS_MSG_TYPE + 1))
968 + return NULL;
969 +
970 + msg_type = *((u8 *)(ptp_loc + PTP_OFFS_MSG_TYPE)) & 0xf;
971 + if ((msg_type == PTP_MSGTYPE_SYNC)
972 + || (msg_type == PTP_MSGTYPE_DELREQ)
973 + || (msg_type == PTP_MSGTYPE_PDELREQ)
974 + || (msg_type == PTP_MSGTYPE_PDELRESP))
975 + return ptp_loc;
976 + break;
977 + /* Transport of PTP over IPv4 */
978 + case ETH_P_IP:
979 + iph = (struct iphdr *)pos;
980 + access_len += sizeof(struct iphdr);
981 +
982 + if (!pskb_may_pull(skb, access_len))
983 + return NULL;
984 +
985 + if (ntohs(iph->protocol) != IPPROTO_UDP)
986 + return NULL;
987 +
988 + access_len += iph->ihl * 4 - sizeof(struct iphdr) +
989 + sizeof(struct udphdr);
990 +
991 + if (!pskb_may_pull(skb, access_len))
992 + return NULL;
993 +
994 + pos += iph->ihl * 4;
995 + udph = (struct udphdr *)pos;
996 + if (ntohs(udph->dest) != 319)
997 + return NULL;
998 + ptp_loc = pos + sizeof(struct udphdr);
999 + break;
1000 + /* Transport of PTP over IPv6 */
1001 + case ETH_P_IPV6:
1002 + ipv6h = (struct ipv6hdr *)pos;
1003 +
1004 + access_len += sizeof(struct ipv6hdr) + sizeof(struct udphdr);
1005 +
1006 + if (ntohs(ipv6h->nexthdr) != IPPROTO_UDP)
1007 + return NULL;
1008 +
1009 + pos += sizeof(struct ipv6hdr);
1010 + udph = (struct udphdr *)pos;
1011 + if (ntohs(udph->dest) != 319)
1012 + return NULL;
1013 + ptp_loc = pos + sizeof(struct udphdr);
1014 + break;
1015 + default:
1016 + break;
1017 + }
1018 +
1019 + return ptp_loc;
1020 +}
1021 +
1022 +static int dpa_ptp_store_stamp(const struct dpa_priv_s *priv,
1023 + struct sk_buff *skb, void *data, enum port_type rx_tx,
1024 + struct dpa_ptp_data *ptp_data)
1025 +{
1026 + u64 nsec;
1027 + u32 mod;
1028 + u8 *ptp_loc;
1029 + u16 eth_type;
1030 +
1031 + ptp_loc = dpa_ptp_parse_packet(skb, &eth_type);
1032 + if (!ptp_loc)
1033 + return -EINVAL;
1034 +
1035 + switch (eth_type) {
1036 + case ETH_P_IP:
1037 + ptp_data->ident.netw_prot = DPA_PTP_PROT_IPV4;
1038 + break;
1039 + case ETH_P_IPV6:
1040 + ptp_data->ident.netw_prot = DPA_PTP_PROT_IPV6;
1041 + break;
1042 + case ETH_P_1588:
1043 + ptp_data->ident.netw_prot = DPA_PTP_PROT_802_3;
1044 + break;
1045 + default:
1046 + return -EINVAL;
1047 + }
1048 +
1049 + if (!pskb_may_pull(skb, ptp_loc - skb->data + PTP_OFFS_SEQ_ID + 2))
1050 + return -EINVAL;
1051 +
1052 + ptp_data->ident.version = *(ptp_loc + PTP_OFFS_VER_PTP) & 0xf;
1053 + ptp_data->ident.msg_type = *(ptp_loc + PTP_OFFS_MSG_TYPE) & 0xf;
1054 + ptp_data->ident.seq_id = *((u16 *)(ptp_loc + PTP_OFFS_SEQ_ID));
1055 + memcpy(ptp_data->ident.snd_port_id, ptp_loc + PTP_OFFS_SRCPRTID,
1056 + DPA_PTP_SOURCE_PORT_LENGTH);
1057 +
1058 + nsec = dpa_get_timestamp_ns(priv, rx_tx, data);
1059 + mod = do_div(nsec, NANOSEC_PER_SECOND);
1060 + ptp_data->ts.sec = nsec;
1061 + ptp_data->ts.nsec = mod;
1062 +
1063 + return 0;
1064 +}
1065 +
1066 +void dpa_ptp_store_txstamp(const struct dpa_priv_s *priv,
1067 + struct sk_buff *skb, void *data)
1068 +{
1069 + struct dpa_ptp_tsu *tsu = priv->tsu;
1070 + struct dpa_ptp_data ptp_tx_data;
1071 +
1072 + if (dpa_ptp_store_stamp(priv, skb, data, TX, &ptp_tx_data))
1073 + return;
1074 +
1075 + dpa_ptp_insert(&tsu->tx_timestamps, &ptp_tx_data);
1076 +}
1077 +
1078 +void dpa_ptp_store_rxstamp(const struct dpa_priv_s *priv,
1079 + struct sk_buff *skb, void *data)
1080 +{
1081 + struct dpa_ptp_tsu *tsu = priv->tsu;
1082 + struct dpa_ptp_data ptp_rx_data;
1083 +
1084 + if (dpa_ptp_store_stamp(priv, skb, data, RX, &ptp_rx_data))
1085 + return;
1086 +
1087 + dpa_ptp_insert(&tsu->rx_timestamps, &ptp_rx_data);
1088 +}
1089 +
1090 +static uint8_t dpa_get_tx_timestamp(struct dpa_ptp_tsu *ptp_tsu,
1091 + struct dpa_ptp_ident *ident,
1092 + struct dpa_ptp_time *ts)
1093 +{
1094 + struct dpa_ptp_tsu *tsu = ptp_tsu;
1095 + struct dpa_ptp_time tmp;
1096 + int flag;
1097 +
1098 + flag = dpa_ptp_find_and_remove(&tsu->tx_timestamps, ident, &tmp);
1099 + if (!flag) {
1100 + ts->sec = tmp.sec;
1101 + ts->nsec = tmp.nsec;
1102 + return 0;
1103 + }
1104 +
1105 + return -1;
1106 +}
1107 +
1108 +static uint8_t dpa_get_rx_timestamp(struct dpa_ptp_tsu *ptp_tsu,
1109 + struct dpa_ptp_ident *ident,
1110 + struct dpa_ptp_time *ts)
1111 +{
1112 + struct dpa_ptp_tsu *tsu = ptp_tsu;
1113 + struct dpa_ptp_time tmp;
1114 + int flag;
1115 +
1116 + flag = dpa_ptp_find_and_remove(&tsu->rx_timestamps, ident, &tmp);
1117 + if (!flag) {
1118 + ts->sec = tmp.sec;
1119 + ts->nsec = tmp.nsec;
1120 + return 0;
1121 + }
1122 +
1123 + return -1;
1124 +}
1125 +
1126 +static void dpa_set_fiper_alarm(struct dpa_ptp_tsu *tsu,
1127 + struct dpa_ptp_time *cnt_time)
1128 +{
1129 + struct mac_device *mac_dev = tsu->dpa_priv->mac_dev;
1130 + u64 tmp, fiper;
1131 +
1132 + if (mac_dev->fm_rtc_disable)
1133 + mac_dev->fm_rtc_disable(get_fm_handle(tsu->dpa_priv->net_dev));
1134 +
1135 + /* TMR_FIPER1 will pulse every second after ALARM1 expired */
1136 + tmp = (u64)cnt_time->sec * NANOSEC_PER_SECOND + (u64)cnt_time->nsec;
1137 + fiper = NANOSEC_PER_SECOND - DPA_PTP_NOMINAL_FREQ_PERIOD_NS;
1138 + if (mac_dev->fm_rtc_set_alarm)
1139 + mac_dev->fm_rtc_set_alarm(get_fm_handle(tsu->dpa_priv->net_dev),
1140 + 0, tmp);
1141 + if (mac_dev->fm_rtc_set_fiper)
1142 + mac_dev->fm_rtc_set_fiper(get_fm_handle(tsu->dpa_priv->net_dev),
1143 + 0, fiper);
1144 +
1145 + if (mac_dev->fm_rtc_enable)
1146 + mac_dev->fm_rtc_enable(get_fm_handle(tsu->dpa_priv->net_dev));
1147 +}
1148 +
1149 +static void dpa_get_curr_cnt(struct dpa_ptp_tsu *tsu,
1150 + struct dpa_ptp_time *curr_time)
1151 +{
1152 + struct mac_device *mac_dev = tsu->dpa_priv->mac_dev;
1153 + u64 tmp;
1154 + u32 mod;
1155 +
1156 + if (mac_dev->fm_rtc_get_cnt)
1157 + mac_dev->fm_rtc_get_cnt(get_fm_handle(tsu->dpa_priv->net_dev),
1158 + &tmp);
1159 +
1160 + mod = do_div(tmp, NANOSEC_PER_SECOND);
1161 + curr_time->sec = (u32)tmp;
1162 + curr_time->nsec = mod;
1163 +}
1164 +
1165 +static void dpa_set_1588cnt(struct dpa_ptp_tsu *tsu,
1166 + struct dpa_ptp_time *cnt_time)
1167 +{
1168 + struct mac_device *mac_dev = tsu->dpa_priv->mac_dev;
1169 + u64 tmp;
1170 +
1171 + tmp = (u64)cnt_time->sec * NANOSEC_PER_SECOND + (u64)cnt_time->nsec;
1172 +
1173 + if (mac_dev->fm_rtc_set_cnt)
1174 + mac_dev->fm_rtc_set_cnt(get_fm_handle(tsu->dpa_priv->net_dev),
1175 + tmp);
1176 +
1177 + /* Restart fiper two seconds later */
1178 + cnt_time->sec += 2;
1179 + cnt_time->nsec = 0;
1180 + dpa_set_fiper_alarm(tsu, cnt_time);
1181 +}
1182 +
1183 +static void dpa_get_drift(struct dpa_ptp_tsu *tsu, u32 *addend)
1184 +{
1185 + struct mac_device *mac_dev = tsu->dpa_priv->mac_dev;
1186 + u32 drift;
1187 +
1188 + if (mac_dev->fm_rtc_get_drift)
1189 + mac_dev->fm_rtc_get_drift(get_fm_handle(tsu->dpa_priv->net_dev),
1190 + &drift);
1191 +
1192 + *addend = drift;
1193 +}
1194 +
1195 +static void dpa_set_drift(struct dpa_ptp_tsu *tsu, u32 addend)
1196 +{
1197 + struct mac_device *mac_dev = tsu->dpa_priv->mac_dev;
1198 +
1199 + if (mac_dev->fm_rtc_set_drift)
1200 + mac_dev->fm_rtc_set_drift(get_fm_handle(tsu->dpa_priv->net_dev),
1201 + addend);
1202 +}
1203 +
1204 +static void dpa_flush_timestamp(struct dpa_ptp_tsu *tsu)
1205 +{
1206 + dpa_ptp_reset_circ(&tsu->rx_timestamps, DEFAULT_PTP_RX_BUF_SZ);
1207 + dpa_ptp_reset_circ(&tsu->tx_timestamps, DEFAULT_PTP_TX_BUF_SZ);
1208 +}
1209 +
1210 +int dpa_ioctl_1588(struct net_device *dev, struct ifreq *ifr, int cmd)
1211 +{
1212 + struct dpa_priv_s *priv = netdev_priv(dev);
1213 + struct dpa_ptp_tsu *tsu = priv->tsu;
1214 + struct mac_device *mac_dev = priv->mac_dev;
1215 + struct dpa_ptp_data ptp_data;
1216 + struct dpa_ptp_data *ptp_data_user;
1217 + struct dpa_ptp_time act_time;
1218 + u32 addend;
1219 + int retval = 0;
1220 +
1221 + if (!tsu || !tsu->valid)
1222 + return -ENODEV;
1223 +
1224 + switch (cmd) {
1225 + case PTP_ENBL_TXTS_IOCTL:
1226 + tsu->hwts_tx_en_ioctl = 1;
1227 + if (mac_dev->fm_rtc_enable)
1228 + mac_dev->fm_rtc_enable(get_fm_handle(dev));
1229 + if (mac_dev->ptp_enable)
1230 + mac_dev->ptp_enable(mac_dev->get_mac_handle(mac_dev));
1231 + break;
1232 + case PTP_DSBL_TXTS_IOCTL:
1233 + tsu->hwts_tx_en_ioctl = 0;
1234 + if (mac_dev->fm_rtc_disable)
1235 + mac_dev->fm_rtc_disable(get_fm_handle(dev));
1236 + if (mac_dev->ptp_disable)
1237 + mac_dev->ptp_disable(mac_dev->get_mac_handle(mac_dev));
1238 + break;
1239 + case PTP_ENBL_RXTS_IOCTL:
1240 + tsu->hwts_rx_en_ioctl = 1;
1241 + break;
1242 + case PTP_DSBL_RXTS_IOCTL:
1243 + tsu->hwts_rx_en_ioctl = 0;
1244 + break;
1245 + case PTP_GET_RX_TIMESTAMP:
1246 + ptp_data_user = (struct dpa_ptp_data *)ifr->ifr_data;
1247 + if (copy_from_user(&ptp_data.ident,
1248 + &ptp_data_user->ident, sizeof(ptp_data.ident)))
1249 + return -EINVAL;
1250 +
1251 + if (dpa_get_rx_timestamp(tsu, &ptp_data.ident, &ptp_data.ts))
1252 + return -EAGAIN;
1253 +
1254 + if (copy_to_user((void __user *)&ptp_data_user->ts,
1255 + &ptp_data.ts, sizeof(ptp_data.ts)))
1256 + return -EFAULT;
1257 + break;
1258 + case PTP_GET_TX_TIMESTAMP:
1259 + ptp_data_user = (struct dpa_ptp_data *)ifr->ifr_data;
1260 + if (copy_from_user(&ptp_data.ident,
1261 + &ptp_data_user->ident, sizeof(ptp_data.ident)))
1262 + return -EINVAL;
1263 +
1264 + if (dpa_get_tx_timestamp(tsu, &ptp_data.ident, &ptp_data.ts))
1265 + return -EAGAIN;
1266 +
1267 + if (copy_to_user((void __user *)&ptp_data_user->ts,
1268 + &ptp_data.ts, sizeof(ptp_data.ts)))
1269 + return -EFAULT;
1270 + break;
1271 + case PTP_GET_TIME:
1272 + dpa_get_curr_cnt(tsu, &act_time);
1273 + if (copy_to_user(ifr->ifr_data, &act_time, sizeof(act_time)))
1274 + return -EFAULT;
1275 + break;
1276 + case PTP_SET_TIME:
1277 + if (copy_from_user(&act_time, ifr->ifr_data, sizeof(act_time)))
1278 + return -EINVAL;
1279 + dpa_set_1588cnt(tsu, &act_time);
1280 + break;
1281 + case PTP_GET_ADJ:
1282 + dpa_get_drift(tsu, &addend);
1283 + if (copy_to_user(ifr->ifr_data, &addend, sizeof(addend)))
1284 + return -EFAULT;
1285 + break;
1286 + case PTP_SET_ADJ:
1287 + if (copy_from_user(&addend, ifr->ifr_data, sizeof(addend)))
1288 + return -EINVAL;
1289 + dpa_set_drift(tsu, addend);
1290 + break;
1291 + case PTP_SET_FIPER_ALARM:
1292 + if (copy_from_user(&act_time, ifr->ifr_data, sizeof(act_time)))
1293 + return -EINVAL;
1294 + dpa_set_fiper_alarm(tsu, &act_time);
1295 + break;
1296 + case PTP_CLEANUP_TS:
1297 + dpa_flush_timestamp(tsu);
1298 + break;
1299 + default:
1300 + return -EINVAL;
1301 + }
1302 +
1303 + return retval;
1304 +}
1305 +
1306 +int dpa_ptp_init(struct dpa_priv_s *priv)
1307 +{
1308 + struct dpa_ptp_tsu *tsu;
1309 +
1310 + /* Allocate memory for PTP structure */
1311 + tsu = kzalloc(sizeof(struct dpa_ptp_tsu), GFP_KERNEL);
1312 + if (!tsu)
1313 + return -ENOMEM;
1314 +
1315 + tsu->valid = TRUE;
1316 + tsu->dpa_priv = priv;
1317 +
1318 + dpa_ptp_init_circ(&tsu->rx_timestamps, DEFAULT_PTP_RX_BUF_SZ);
1319 + dpa_ptp_init_circ(&tsu->tx_timestamps, DEFAULT_PTP_TX_BUF_SZ);
1320 +
1321 + priv->tsu = tsu;
1322 +
1323 + return 0;
1324 +}
1325 +EXPORT_SYMBOL(dpa_ptp_init);
1326 +
1327 +void dpa_ptp_cleanup(struct dpa_priv_s *priv)
1328 +{
1329 + struct dpa_ptp_tsu *tsu = priv->tsu;
1330 +
1331 + tsu->valid = FALSE;
1332 + vfree(tsu->rx_timestamps.circ_buf.buf);
1333 + vfree(tsu->tx_timestamps.circ_buf.buf);
1334 +
1335 + kfree(tsu);
1336 +}
1337 +EXPORT_SYMBOL(dpa_ptp_cleanup);
1338 --- /dev/null
1339 +++ b/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_1588.h
1340 @@ -0,0 +1,138 @@
1341 +/* Copyright (C) 2011 Freescale Semiconductor, Inc.
1342 + *
1343 + * This program is free software; you can redistribute it and/or modify
1344 + * it under the terms of the GNU General Public License as published by
1345 + * the Free Software Foundation; either version 2 of the License, or
1346 + * (at your option) any later version.
1347 + *
1348 + * This program is distributed in the hope that it will be useful,
1349 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1350 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1351 + * GNU General Public License for more details.
1352 + *
1353 + * You should have received a copy of the GNU General Public License along
1354 + * with this program; if not, write to the Free Software Foundation, Inc.,
1355 + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
1356 + *
1357 + */
1358 +#ifndef __DPAA_1588_H__
1359 +#define __DPAA_1588_H__
1360 +
1361 +#include <linux/netdevice.h>
1362 +#include <linux/etherdevice.h>
1363 +#include <linux/circ_buf.h>
1364 +#include <linux/fsl_qman.h>
1365 +
1366 +#define DEFAULT_PTP_RX_BUF_SZ 256
1367 +#define DEFAULT_PTP_TX_BUF_SZ 256
1368 +
1369 +/* 1588 private ioctl calls */
1370 +#define PTP_ENBL_TXTS_IOCTL SIOCDEVPRIVATE
1371 +#define PTP_DSBL_TXTS_IOCTL (SIOCDEVPRIVATE + 1)
1372 +#define PTP_ENBL_RXTS_IOCTL (SIOCDEVPRIVATE + 2)
1373 +#define PTP_DSBL_RXTS_IOCTL (SIOCDEVPRIVATE + 3)
1374 +#define PTP_GET_TX_TIMESTAMP (SIOCDEVPRIVATE + 4)
1375 +#define PTP_GET_RX_TIMESTAMP (SIOCDEVPRIVATE + 5)
1376 +#define PTP_SET_TIME (SIOCDEVPRIVATE + 6)
1377 +#define PTP_GET_TIME (SIOCDEVPRIVATE + 7)
1378 +#define PTP_SET_FIPER_ALARM (SIOCDEVPRIVATE + 8)
1379 +#define PTP_SET_ADJ (SIOCDEVPRIVATE + 9)
1380 +#define PTP_GET_ADJ (SIOCDEVPRIVATE + 10)
1381 +#define PTP_CLEANUP_TS (SIOCDEVPRIVATE + 11)
1382 +
1383 +/* PTP V2 message type */
1384 +enum {
1385 + PTP_MSGTYPE_SYNC = 0x0,
1386 + PTP_MSGTYPE_DELREQ = 0x1,
1387 + PTP_MSGTYPE_PDELREQ = 0x2,
1388 + PTP_MSGTYPE_PDELRESP = 0x3,
1389 + PTP_MSGTYPE_FLWUP = 0x8,
1390 + PTP_MSGTYPE_DELRESP = 0x9,
1391 + PTP_MSGTYPE_PDELRES_FLWUP = 0xA,
1392 + PTP_MSGTYPE_ANNOUNCE = 0xB,
1393 + PTP_MSGTYPE_SGNLNG = 0xC,
1394 + PTP_MSGTYPE_MNGMNT = 0xD,
1395 +};
1396 +
1397 +/* Byte offset of data in the PTP V2 headers */
1398 +#define PTP_OFFS_MSG_TYPE 0
1399 +#define PTP_OFFS_VER_PTP 1
1400 +#define PTP_OFFS_MSG_LEN 2
1401 +#define PTP_OFFS_DOM_NMB 4
1402 +#define PTP_OFFS_FLAGS 6
1403 +#define PTP_OFFS_CORFIELD 8
1404 +#define PTP_OFFS_SRCPRTID 20
1405 +#define PTP_OFFS_SEQ_ID 30
1406 +#define PTP_OFFS_CTRL 32
1407 +#define PTP_OFFS_LOGMEAN 33
1408 +
1409 +#define PTP_IP_OFFS 14
1410 +#define PTP_UDP_OFFS 34
1411 +#define PTP_HEADER_OFFS 42
1412 +#define PTP_MSG_TYPE_OFFS (PTP_HEADER_OFFS + PTP_OFFS_MSG_TYPE)
1413 +#define PTP_SPORT_ID_OFFS (PTP_HEADER_OFFS + PTP_OFFS_SRCPRTID)
1414 +#define PTP_SEQ_ID_OFFS (PTP_HEADER_OFFS + PTP_OFFS_SEQ_ID)
1415 +#define PTP_CTRL_OFFS (PTP_HEADER_OFFS + PTP_OFFS_CTRL)
1416 +
1417 +/* 1588-2008 network protocol enumeration values */
1418 +#define DPA_PTP_PROT_IPV4 1
1419 +#define DPA_PTP_PROT_IPV6 2
1420 +#define DPA_PTP_PROT_802_3 3
1421 +#define DPA_PTP_PROT_DONTCARE 0xFFFF
1422 +
1423 +#define DPA_PTP_SOURCE_PORT_LENGTH 10
1424 +#define DPA_PTP_HEADER_SZE 34
1425 +#define DPA_ETYPE_LEN 2
1426 +#define DPA_VLAN_TAG_LEN 4
1427 +#define NANOSEC_PER_SECOND 1000000000
1428 +
1429 +/* The threshold between the current found one and the oldest one */
1430 +#define TS_ACCUMULATION_THRESHOLD 50
1431 +
1432 +/* Struct needed to identify a timestamp */
1433 +struct dpa_ptp_ident {
1434 + u8 version;
1435 + u8 msg_type;
1436 + u16 netw_prot;
1437 + u16 seq_id;
1438 + u8 snd_port_id[DPA_PTP_SOURCE_PORT_LENGTH];
1439 +};
1440 +
1441 +/* Timestamp format in 1588-2008 */
1442 +struct dpa_ptp_time {
1443 + u64 sec; /* just 48 bit used */
1444 + u32 nsec;
1445 +};
1446 +
1447 +/* needed for timestamp data over ioctl */
1448 +struct dpa_ptp_data {
1449 + struct dpa_ptp_ident ident;
1450 + struct dpa_ptp_time ts;
1451 +};
1452 +
1453 +struct dpa_ptp_circ_buf {
1454 + struct circ_buf circ_buf;
1455 + u32 size;
1456 + spinlock_t ptp_lock;
1457 +};
1458 +
1459 +/* PTP TSU control structure */
1460 +struct dpa_ptp_tsu {
1461 + struct dpa_priv_s *dpa_priv;
1462 + bool valid;
1463 + struct dpa_ptp_circ_buf rx_timestamps;
1464 + struct dpa_ptp_circ_buf tx_timestamps;
1465 +
1466 + /* HW timestamping over ioctl enabled flag */
1467 + int hwts_tx_en_ioctl;
1468 + int hwts_rx_en_ioctl;
1469 +};
1470 +
1471 +extern int dpa_ptp_init(struct dpa_priv_s *priv);
1472 +extern void dpa_ptp_cleanup(struct dpa_priv_s *priv);
1473 +extern void dpa_ptp_store_txstamp(const struct dpa_priv_s *priv,
1474 + struct sk_buff *skb, void *data);
1475 +extern void dpa_ptp_store_rxstamp(const struct dpa_priv_s *priv,
1476 + struct sk_buff *skb, void *data);
1477 +extern int dpa_ioctl_1588(struct net_device *dev, struct ifreq *ifr, int cmd);
1478 +#endif
1479 --- /dev/null
1480 +++ b/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_debugfs.c
1481 @@ -0,0 +1,180 @@
1482 +/* Copyright 2008-2013 Freescale Semiconductor Inc.
1483 + *
1484 + * Redistribution and use in source and binary forms, with or without
1485 + * modification, are permitted provided that the following conditions are met:
1486 + * * Redistributions of source code must retain the above copyright
1487 + * notice, this list of conditions and the following disclaimer.
1488 + * * Redistributions in binary form must reproduce the above copyright
1489 + * notice, this list of conditions and the following disclaimer in the
1490 + * documentation and/or other materials provided with the distribution.
1491 + * * Neither the name of Freescale Semiconductor nor the
1492 + * names of its contributors may be used to endorse or promote products
1493 + * derived from this software without specific prior written permission.
1494 + *
1495 + *
1496 + * ALTERNATIVELY, this software may be distributed under the terms of the
1497 + * GNU General Public License ("GPL") as published by the Free Software
1498 + * Foundation, either version 2 of that License or (at your option) any
1499 + * later version.
1500 + *
1501 + * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
1502 + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
1503 + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
1504 + * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
1505 + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
1506 + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
1507 + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
1508 + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
1509 + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
1510 + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1511 + */
1512 +
1513 +#include <linux/module.h>
1514 +#include <linux/fsl_qman.h> /* struct qm_mcr_querycgr */
1515 +#include <linux/debugfs.h>
1516 +#include "dpaa_debugfs.h"
1517 +#include "dpaa_eth.h" /* struct dpa_priv_s, dpa_percpu_priv_s, dpa_bp */
1518 +
1519 +#define DPA_DEBUGFS_DESCRIPTION "FSL DPAA Ethernet debugfs entries"
1520 +#define DPA_ETH_DEBUGFS_ROOT "fsl_dpa"
1521 +
1522 +static struct dentry *dpa_debugfs_root;
1523 +
1524 +static int __cold dpa_debugfs_loop_open(struct inode *inode, struct file *file);
1525 +static ssize_t dpa_loop_write(struct file *f,
1526 + const char __user *buf, size_t count, loff_t *off);
1527 +
1528 +static const struct file_operations dpa_debugfs_lp_fops = {
1529 + .open = dpa_debugfs_loop_open,
1530 + .write = dpa_loop_write,
1531 + .read = seq_read,
1532 + .llseek = seq_lseek,
1533 + .release = single_release,
1534 +};
1535 +
1536 +static int dpa_debugfs_loop_show(struct seq_file *file, void *offset)
1537 +{
1538 + struct dpa_priv_s *priv;
1539 +
1540 + BUG_ON(offset == NULL);
1541 +
1542 + priv = netdev_priv((struct net_device *)file->private);
1543 + seq_printf(file, "%d->%d\n", priv->loop_id, priv->loop_to);
1544 +
1545 + return 0;
1546 +}
1547 +
1548 +static int user_input_convert(const char __user *user_buf, size_t count,
1549 + long *val)
1550 +{
1551 + char buf[12];
1552 +
1553 + if (count > sizeof(buf) - 1)
1554 + return -EINVAL;
1555 + if (copy_from_user(buf, user_buf, count))
1556 + return -EFAULT;
1557 + buf[count] = '\0';
1558 + if (kstrtol(buf, 0, val))
1559 + return -EINVAL;
1560 + return 0;
1561 +}
1562 +
1563 +static ssize_t dpa_loop_write(struct file *f,
1564 + const char __user *buf, size_t count, loff_t *off)
1565 +{
1566 + struct dpa_priv_s *priv;
1567 + struct net_device *netdev;
1568 + struct seq_file *sf;
1569 + int ret;
1570 + long val;
1571 +
1572 + ret = user_input_convert(buf, count, &val);
1573 + if (ret)
1574 + return ret;
1575 +
1576 + sf = (struct seq_file *)f->private_data;
1577 + netdev = (struct net_device *)sf->private;
1578 + priv = netdev_priv(netdev);
1579 +
1580 + priv->loop_to = ((val < 0) || (val > 20)) ? -1 : val;
1581 +
1582 + return count;
1583 +}
1584 +
1585 +static int __cold dpa_debugfs_loop_open(struct inode *inode, struct file *file)
1586 +{
1587 + int _errno;
1588 + const struct net_device *net_dev;
1589 +
1590 + _errno = single_open(file, dpa_debugfs_loop_show, inode->i_private);
1591 + if (unlikely(_errno < 0)) {
1592 + net_dev = (struct net_device *)inode->i_private;
1593 +
1594 + if (netif_msg_drv((struct dpa_priv_s *)netdev_priv(net_dev)))
1595 + netdev_err(net_dev, "single_open() = %d\n",
1596 + _errno);
1597 + }
1598 +
1599 + return _errno;
1600 +}
1601 +
1602 +
1603 +int dpa_netdev_debugfs_create(struct net_device *net_dev)
1604 +{
1605 + struct dpa_priv_s *priv = netdev_priv(net_dev);
1606 + static int cnt;
1607 + char loop_file_name[100];
1608 +
1609 + if (unlikely(dpa_debugfs_root == NULL)) {
1610 + pr_err(KBUILD_MODNAME ": %s:%hu:%s(): \t%s\n",
1611 + KBUILD_BASENAME".c", __LINE__, __func__,
1612 + "root debugfs missing, possible module ordering issue");
1613 + return -ENOMEM;
1614 + }
1615 +
1616 + sprintf(loop_file_name, "eth%d_loop", ++cnt);
1617 + priv->debugfs_loop_file = debugfs_create_file(loop_file_name,
1618 + S_IRUGO,
1619 + dpa_debugfs_root,
1620 + net_dev,
1621 + &dpa_debugfs_lp_fops);
1622 + if (unlikely(priv->debugfs_loop_file == NULL)) {
1623 + netdev_err(net_dev, "debugfs_create_file(%s/%s)",
1624 + dpa_debugfs_root->d_iname,
1625 + loop_file_name);
1626 +
1627 + return -ENOMEM;
1628 + }
1629 + return 0;
1630 +}
1631 +
1632 +void dpa_netdev_debugfs_remove(struct net_device *net_dev)
1633 +{
1634 + struct dpa_priv_s *priv = netdev_priv(net_dev);
1635 +
1636 + debugfs_remove(priv->debugfs_loop_file);
1637 +}
1638 +
1639 +int __init dpa_debugfs_module_init(void)
1640 +{
1641 + int _errno = 0;
1642 +
1643 + pr_info(KBUILD_MODNAME ": " DPA_DEBUGFS_DESCRIPTION "\n");
1644 +
1645 + dpa_debugfs_root = debugfs_create_dir(DPA_ETH_DEBUGFS_ROOT, NULL);
1646 +
1647 + if (unlikely(dpa_debugfs_root == NULL)) {
1648 + _errno = -ENOMEM;
1649 + pr_err(KBUILD_MODNAME ": %s:%hu:%s():\n",
1650 + KBUILD_BASENAME".c", __LINE__, __func__);
1651 + pr_err("\tdebugfs_create_dir(%s/"KBUILD_MODNAME") = %d\n",
1652 + DPA_ETH_DEBUGFS_ROOT, _errno);
1653 + }
1654 +
1655 + return _errno;
1656 +}
1657 +
1658 +void __exit dpa_debugfs_module_exit(void)
1659 +{
1660 + debugfs_remove(dpa_debugfs_root);
1661 +}
1662 --- /dev/null
1663 +++ b/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_debugfs.h
1664 @@ -0,0 +1,43 @@
1665 +/* Copyright 2008-2013 Freescale Semiconductor Inc.
1666 + *
1667 + * Redistribution and use in source and binary forms, with or without
1668 + * modification, are permitted provided that the following conditions are met:
1669 + * * Redistributions of source code must retain the above copyright
1670 + * notice, this list of conditions and the following disclaimer.
1671 + * * Redistributions in binary form must reproduce the above copyright
1672 + * notice, this list of conditions and the following disclaimer in the
1673 + * documentation and/or other materials provided with the distribution.
1674 + * * Neither the name of Freescale Semiconductor nor the
1675 + * names of its contributors may be used to endorse or promote products
1676 + * derived from this software without specific prior written permission.
1677 + *
1678 + *
1679 + * ALTERNATIVELY, this software may be distributed under the terms of the
1680 + * GNU General Public License ("GPL") as published by the Free Software
1681 + * Foundation, either version 2 of that License or (at your option) any
1682 + * later version.
1683 + *
1684 + * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
1685 + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
1686 + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
1687 + * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
1688 + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
1689 + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
1690 + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
1691 + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
1692 + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
1693 + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1694 + */
1695 +
1696 +#ifndef DPAA_DEBUGFS_H_
1697 +#define DPAA_DEBUGFS_H_
1698 +
1699 +#include <linux/netdevice.h>
1700 +#include <linux/dcache.h> /* struct dentry needed in dpaa_eth.h */
1701 +
1702 +int dpa_netdev_debugfs_create(struct net_device *net_dev);
1703 +void dpa_netdev_debugfs_remove(struct net_device *net_dev);
1704 +int __init dpa_debugfs_module_init(void);
1705 +void __exit dpa_debugfs_module_exit(void);
1706 +
1707 +#endif /* DPAA_DEBUGFS_H_ */
1708 --- /dev/null
1709 +++ b/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth.c
1710 @@ -0,0 +1,1213 @@
1711 +/* Copyright 2008-2013 Freescale Semiconductor Inc.
1712 + *
1713 + * Redistribution and use in source and binary forms, with or without
1714 + * modification, are permitted provided that the following conditions are met:
1715 + * * Redistributions of source code must retain the above copyright
1716 + * notice, this list of conditions and the following disclaimer.
1717 + * * Redistributions in binary form must reproduce the above copyright
1718 + * notice, this list of conditions and the following disclaimer in the
1719 + * documentation and/or other materials provided with the distribution.
1720 + * * Neither the name of Freescale Semiconductor nor the
1721 + * names of its contributors may be used to endorse or promote products
1722 + * derived from this software without specific prior written permission.
1723 + *
1724 + *
1725 + * ALTERNATIVELY, this software may be distributed under the terms of the
1726 + * GNU General Public License ("GPL") as published by the Free Software
1727 + * Foundation, either version 2 of that License or (at your option) any
1728 + * later version.
1729 + *
1730 + * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
1731 + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
1732 + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
1733 + * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
1734 + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
1735 + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
1736 + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
1737 + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
1738 + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
1739 + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1740 + */
1741 +
1742 +#ifdef CONFIG_FSL_DPAA_ETH_DEBUG
1743 +#define pr_fmt(fmt) \
1744 + KBUILD_MODNAME ": %s:%hu:%s() " fmt, \
1745 + KBUILD_BASENAME".c", __LINE__, __func__
1746 +#else
1747 +#define pr_fmt(fmt) \
1748 + KBUILD_MODNAME ": " fmt
1749 +#endif
1750 +
1751 +#include <linux/init.h>
1752 +#include <linux/module.h>
1753 +#include <linux/of_mdio.h>
1754 +#include <linux/of_net.h>
1755 +#include <linux/kthread.h>
1756 +#include <linux/io.h>
1757 +#include <linux/if_arp.h> /* arp_hdr_len() */
1758 +#include <linux/if_vlan.h> /* VLAN_HLEN */
1759 +#include <linux/icmp.h> /* struct icmphdr */
1760 +#include <linux/ip.h> /* struct iphdr */
1761 +#include <linux/ipv6.h> /* struct ipv6hdr */
1762 +#include <linux/udp.h> /* struct udphdr */
1763 +#include <linux/tcp.h> /* struct tcphdr */
1764 +#include <linux/net.h> /* net_ratelimit() */
1765 +#include <linux/if_ether.h> /* ETH_P_IP and ETH_P_IPV6 */
1766 +#include <linux/highmem.h>
1767 +#include <linux/percpu.h>
1768 +#include <linux/dma-mapping.h>
1769 +#include <linux/fsl_bman.h>
1770 +#ifdef CONFIG_SOC_BUS
1771 +#include <linux/sys_soc.h> /* soc_device_match */
1772 +#endif
1773 +
1774 +#include "fsl_fman.h"
1775 +#include "fm_ext.h"
1776 +#include "fm_port_ext.h"
1777 +
1778 +#include "mac.h"
1779 +#include "dpaa_eth.h"
1780 +#include "dpaa_eth_common.h"
1781 +#ifdef CONFIG_FSL_DPAA_DBG_LOOP
1782 +#include "dpaa_debugfs.h"
1783 +#endif /* CONFIG_FSL_DPAA_DBG_LOOP */
1784 +
1785 +/* CREATE_TRACE_POINTS only needs to be defined once. Other dpa files
1786 + * using trace events only need to #include <trace/events/sched.h>
1787 + */
1788 +#define CREATE_TRACE_POINTS
1789 +#include "dpaa_eth_trace.h"
1790 +
1791 +#define DPA_NAPI_WEIGHT 64
1792 +
1793 +/* Valid checksum indication */
1794 +#define DPA_CSUM_VALID 0xFFFF
1795 +
1796 +#define DPA_DESCRIPTION "FSL DPAA Ethernet driver"
1797 +
1798 +MODULE_LICENSE("Dual BSD/GPL");
1799 +
1800 +MODULE_AUTHOR("Andy Fleming <afleming@freescale.com>");
1801 +
1802 +MODULE_DESCRIPTION(DPA_DESCRIPTION);
1803 +
1804 +static uint8_t debug = -1;
1805 +module_param(debug, byte, S_IRUGO);
1806 +MODULE_PARM_DESC(debug, "Module/Driver verbosity level");
1807 +
1808 +/* This has to work in tandem with the DPA_CS_THRESHOLD_xxx values. */
1809 +static uint16_t tx_timeout = 1000;
1810 +module_param(tx_timeout, ushort, S_IRUGO);
1811 +MODULE_PARM_DESC(tx_timeout, "The Tx timeout in ms");
1812 +
1813 +static const char rtx[][3] = {
1814 + [RX] = "RX",
1815 + [TX] = "TX"
1816 +};
1817 +
1818 +#ifndef CONFIG_PPC
1819 +bool dpaa_errata_a010022;
1820 +EXPORT_SYMBOL(dpaa_errata_a010022);
1821 +#endif
1822 +
1823 +/* BM */
1824 +
1825 +#define DPAA_ETH_MAX_PAD (L1_CACHE_BYTES * 8)
1826 +
1827 +static uint8_t dpa_priv_common_bpid;
1828 +
1829 +#ifdef CONFIG_FSL_DPAA_DBG_LOOP
1830 +struct net_device *dpa_loop_netdevs[20];
1831 +#endif
1832 +
1833 +#ifdef CONFIG_PM
1834 +
1835 +static int dpaa_suspend(struct device *dev)
1836 +{
1837 + struct net_device *net_dev;
1838 + struct dpa_priv_s *priv;
1839 + struct mac_device *mac_dev;
1840 + int err = 0;
1841 +
1842 + net_dev = dev_get_drvdata(dev);
1843 +
1844 + if (net_dev->flags & IFF_UP) {
1845 + priv = netdev_priv(net_dev);
1846 + mac_dev = priv->mac_dev;
1847 +
1848 + if (priv->wol & DPAA_WOL_MAGIC) {
1849 + err = priv->mac_dev->set_wol(mac_dev->port_dev[RX],
1850 + priv->mac_dev->get_mac_handle(mac_dev), true);
1851 + if (err) {
1852 + netdev_err(net_dev, "set_wol() = %d\n", err);
1853 + goto set_wol_failed;
1854 + }
1855 + }
1856 +
1857 + err = fm_port_suspend(mac_dev->port_dev[RX]);
1858 + if (err) {
1859 + netdev_err(net_dev, "fm_port_suspend(RX) = %d\n", err);
1860 + goto rx_port_suspend_failed;
1861 + }
1862 +
1863 + err = fm_port_suspend(mac_dev->port_dev[TX]);
1864 + if (err) {
1865 + netdev_err(net_dev, "fm_port_suspend(TX) = %d\n", err);
1866 + goto tx_port_suspend_failed;
1867 + }
1868 + }
1869 +
1870 + return 0;
1871 +
1872 +tx_port_suspend_failed:
1873 + fm_port_resume(mac_dev->port_dev[RX]);
1874 +rx_port_suspend_failed:
1875 + if (priv->wol & DPAA_WOL_MAGIC) {
1876 + priv->mac_dev->set_wol(mac_dev->port_dev[RX],
1877 + priv->mac_dev->get_mac_handle(mac_dev), false);
1878 + }
1879 +set_wol_failed:
1880 + return err;
1881 +}
1882 +
1883 +static int dpaa_resume(struct device *dev)
1884 +{
1885 + struct net_device *net_dev;
1886 + struct dpa_priv_s *priv;
1887 + struct mac_device *mac_dev;
1888 + int err = 0;
1889 +
1890 + net_dev = dev_get_drvdata(dev);
1891 +
1892 + if (net_dev->flags & IFF_UP) {
1893 + priv = netdev_priv(net_dev);
1894 + mac_dev = priv->mac_dev;
1895 +
1896 + err = fm_mac_resume(mac_dev->get_mac_handle(mac_dev));
1897 + if (err) {
1898 + netdev_err(net_dev, "fm_mac_resume = %d\n", err);
1899 + goto resume_failed;
1900 + }
1901 +
1902 + err = fm_port_resume(mac_dev->port_dev[TX]);
1903 + if (err) {
1904 + netdev_err(net_dev, "fm_port_resume(TX) = %d\n", err);
1905 + goto resume_failed;
1906 + }
1907 +
1908 + err = fm_port_resume(mac_dev->port_dev[RX]);
1909 + if (err) {
1910 + netdev_err(net_dev, "fm_port_resume(RX) = %d\n", err);
1911 + goto resume_failed;
1912 + }
1913 +
1914 + if (priv->wol & DPAA_WOL_MAGIC) {
1915 + err = priv->mac_dev->set_wol(mac_dev->port_dev[RX],
1916 + priv->mac_dev->get_mac_handle(mac_dev), false);
1917 + if (err) {
1918 + netdev_err(net_dev, "set_wol() = %d\n", err);
1919 + goto resume_failed;
1920 + }
1921 + }
1922 + }
1923 +
1924 + return 0;
1925 +
1926 +resume_failed:
1927 + return err;
1928 +}
1929 +
1930 +static const struct dev_pm_ops dpaa_pm_ops = {
1931 + .suspend = dpaa_suspend,
1932 + .resume = dpaa_resume,
1933 +};
1934 +
1935 +#define DPAA_PM_OPS (&dpaa_pm_ops)
1936 +
1937 +#else /* CONFIG_PM */
1938 +
1939 +#define DPAA_PM_OPS NULL
1940 +
1941 +#endif /* CONFIG_PM */
1942 +
1943 +/* Checks whether the checksum field in Parse Results array is valid
1944 + * (equals 0xFFFF) and increments the .cse counter otherwise
1945 + */
1946 +static inline void
1947 +dpa_csum_validation(const struct dpa_priv_s *priv,
1948 + struct dpa_percpu_priv_s *percpu_priv,
1949 + const struct qm_fd *fd)
1950 +{
1951 + dma_addr_t addr = qm_fd_addr(fd);
1952 + struct dpa_bp *dpa_bp = priv->dpa_bp;
1953 + void *frm = phys_to_virt(addr);
1954 + fm_prs_result_t *parse_result;
1955 +
1956 + if (unlikely(!frm))
1957 + return;
1958 +
1959 + dma_sync_single_for_cpu(dpa_bp->dev, addr, DPA_RX_PRIV_DATA_SIZE +
1960 + DPA_PARSE_RESULTS_SIZE, DMA_BIDIRECTIONAL);
1961 +
1962 + parse_result = (fm_prs_result_t *)(frm + DPA_RX_PRIV_DATA_SIZE);
1963 +
1964 + if (parse_result->cksum != DPA_CSUM_VALID)
1965 + percpu_priv->rx_errors.cse++;
1966 +}
1967 +
1968 +static void _dpa_rx_error(struct net_device *net_dev,
1969 + const struct dpa_priv_s *priv,
1970 + struct dpa_percpu_priv_s *percpu_priv,
1971 + const struct qm_fd *fd,
1972 + u32 fqid)
1973 +{
1974 + /* limit common, possibly innocuous Rx FIFO Overflow errors'
1975 + * interference with zero-loss convergence benchmark results.
1976 + */
1977 + if (likely(fd->status & FM_FD_STAT_ERR_PHYSICAL))
1978 + pr_warn_once("fsl-dpa: non-zero error counters in fman statistics (sysfs)\n");
1979 + else
1980 + if (netif_msg_hw(priv) && net_ratelimit())
1981 + netdev_dbg(net_dev, "Err FD status = 0x%08x\n",
1982 + fd->status & FM_FD_STAT_RX_ERRORS);
1983 +#ifdef CONFIG_FSL_DPAA_HOOKS
1984 + if (dpaa_eth_hooks.rx_error &&
1985 + dpaa_eth_hooks.rx_error(net_dev, fd, fqid) == DPAA_ETH_STOLEN)
1986 + /* it's up to the hook to perform resource cleanup */
1987 + return;
1988 +#endif
1989 + percpu_priv->stats.rx_errors++;
1990 +
1991 + if (fd->status & FM_PORT_FRM_ERR_DMA)
1992 + percpu_priv->rx_errors.dme++;
1993 + if (fd->status & FM_PORT_FRM_ERR_PHYSICAL)
1994 + percpu_priv->rx_errors.fpe++;
1995 + if (fd->status & FM_PORT_FRM_ERR_SIZE)
1996 + percpu_priv->rx_errors.fse++;
1997 + if (fd->status & FM_PORT_FRM_ERR_PRS_HDR_ERR)
1998 + percpu_priv->rx_errors.phe++;
1999 + if (fd->status & FM_FD_STAT_L4CV)
2000 + dpa_csum_validation(priv, percpu_priv, fd);
2001 +
2002 + dpa_fd_release(net_dev, fd);
2003 +}
2004 +
2005 +static void _dpa_tx_error(struct net_device *net_dev,
2006 + const struct dpa_priv_s *priv,
2007 + struct dpa_percpu_priv_s *percpu_priv,
2008 + const struct qm_fd *fd,
2009 + u32 fqid)
2010 +{
2011 + struct sk_buff *skb;
2012 +
2013 + if (netif_msg_hw(priv) && net_ratelimit())
2014 + netdev_warn(net_dev, "FD status = 0x%08x\n",
2015 + fd->status & FM_FD_STAT_TX_ERRORS);
2016 +#ifdef CONFIG_FSL_DPAA_HOOKS
2017 + if (dpaa_eth_hooks.tx_error &&
2018 + dpaa_eth_hooks.tx_error(net_dev, fd, fqid) == DPAA_ETH_STOLEN)
2019 + /* now the hook must ensure proper cleanup */
2020 + return;
2021 +#endif
2022 + percpu_priv->stats.tx_errors++;
2023 +
2024 + /* If we intended the buffers from this frame to go into the bpools
2025 + * when the FMan transmit was done, we need to put it in manually.
2026 + */
2027 + if (fd->bpid != 0xff) {
2028 + dpa_fd_release(net_dev, fd);
2029 + return;
2030 + }
2031 +
2032 + skb = _dpa_cleanup_tx_fd(priv, fd);
2033 + dev_kfree_skb(skb);
2034 +}
2035 +
2036 +/* Helper function to factor out frame validation logic on all Rx paths. Its
2037 + * purpose is to extract from the Parse Results structure information about
2038 + * the integrity of the frame, its checksum, the length of the parsed headers
2039 + * and whether the frame is suitable for GRO.
2040 + *
2041 + * Assumes no parser errors, since any error frame is dropped before this
2042 + * function is called.
2043 + *
2044 + * @skb will have its ip_summed field overwritten;
2045 + * @use_gro will only be written with 0, if the frame is definitely not
2046 + * GRO-able; otherwise, it will be left unchanged;
2047 + * @hdr_size will be written with a safe value, at least the size of the
2048 + * headers' length.
2049 + */
2050 +void __hot _dpa_process_parse_results(const fm_prs_result_t *parse_results,
2051 + const struct qm_fd *fd,
2052 + struct sk_buff *skb, int *use_gro)
2053 +{
2054 + if (fd->status & FM_FD_STAT_L4CV) {
2055 + /* The parser has run and performed L4 checksum validation.
2056 + * We know there were no parser errors (and implicitly no
2057 + * L4 csum error), otherwise we wouldn't be here.
2058 + */
2059 + skb->ip_summed = CHECKSUM_UNNECESSARY;
2060 +
2061 + /* Don't go through GRO for certain types of traffic that
2062 + * we know are not GRO-able, such as dgram-based protocols.
2063 + * In the worst-case scenarios, such as small-pkt terminating
2064 + * UDP, the extra GRO processing would be overkill.
2065 + *
2066 + * The only protocol the Parser supports that is also GRO-able
2067 + * is currently TCP.
2068 + */
2069 + if (!fm_l4_frame_is_tcp(parse_results))
2070 + *use_gro = 0;
2071 +
2072 + return;
2073 + }
2074 +
2075 + /* We're here because either the parser didn't run or the L4 checksum
2076 + * was not verified. This may include the case of a UDP frame with
2077 + * checksum zero or an L4 proto other than TCP/UDP
2078 + */
2079 + skb->ip_summed = CHECKSUM_NONE;
2080 +
2081 + /* Bypass GRO for unknown traffic or if no PCDs are applied */
2082 + *use_gro = 0;
2083 +}
2084 +
2085 +int dpaa_eth_poll(struct napi_struct *napi, int budget)
2086 +{
2087 + struct dpa_napi_portal *np =
2088 + container_of(napi, struct dpa_napi_portal, napi);
2089 +
2090 + int cleaned = qman_p_poll_dqrr(np->p, budget);
2091 +
2092 + if (cleaned < budget) {
2093 + int tmp;
2094 + napi_complete(napi);
2095 + tmp = qman_p_irqsource_add(np->p, QM_PIRQ_DQRI);
2096 + DPA_BUG_ON(tmp);
2097 + }
2098 +
2099 + return cleaned;
2100 +}
2101 +EXPORT_SYMBOL(dpaa_eth_poll);
2102 +
2103 +static void __hot _dpa_tx_conf(struct net_device *net_dev,
2104 + const struct dpa_priv_s *priv,
2105 + struct dpa_percpu_priv_s *percpu_priv,
2106 + const struct qm_fd *fd,
2107 + u32 fqid)
2108 +{
2109 + struct sk_buff *skb;
2110 +
2111 + /* do we need the timestamp for the error frames? */
2112 +
2113 + if (unlikely(fd->status & FM_FD_STAT_TX_ERRORS) != 0) {
2114 + if (netif_msg_hw(priv) && net_ratelimit())
2115 + netdev_warn(net_dev, "FD status = 0x%08x\n",
2116 + fd->status & FM_FD_STAT_TX_ERRORS);
2117 +
2118 + percpu_priv->stats.tx_errors++;
2119 + }
2120 +
2121 + /* hopefully we need not get the timestamp before the hook */
2122 +#ifdef CONFIG_FSL_DPAA_HOOKS
2123 + if (dpaa_eth_hooks.tx_confirm && dpaa_eth_hooks.tx_confirm(net_dev,
2124 + fd, fqid) == DPAA_ETH_STOLEN)
2125 + /* it's the hook that must now perform cleanup */
2126 + return;
2127 +#endif
2128 + /* This might not perfectly reflect the reality, if the core dequeuing
2129 + * the Tx confirmation is different from the one that did the enqueue,
2130 + * but at least it'll show up in the total count.
2131 + */
2132 + percpu_priv->tx_confirm++;
2133 +
2134 + skb = _dpa_cleanup_tx_fd(priv, fd);
2135 +
2136 + dev_kfree_skb(skb);
2137 +}
2138 +
2139 +enum qman_cb_dqrr_result
2140 +priv_rx_error_dqrr(struct qman_portal *portal,
2141 + struct qman_fq *fq,
2142 + const struct qm_dqrr_entry *dq)
2143 +{
2144 + struct net_device *net_dev;
2145 + struct dpa_priv_s *priv;
2146 + struct dpa_percpu_priv_s *percpu_priv;
2147 + int *count_ptr;
2148 +
2149 + net_dev = ((struct dpa_fq *)fq)->net_dev;
2150 + priv = netdev_priv(net_dev);
2151 +
2152 + percpu_priv = raw_cpu_ptr(priv->percpu_priv);
2153 + count_ptr = raw_cpu_ptr(priv->dpa_bp->percpu_count);
2154 +
2155 + if (dpaa_eth_napi_schedule(percpu_priv, portal))
2156 + return qman_cb_dqrr_stop;
2157 +
2158 + if (unlikely(dpaa_eth_refill_bpools(priv->dpa_bp, count_ptr)))
2159 + /* Unable to refill the buffer pool due to insufficient
2160 + * system memory. Just release the frame back into the pool,
2161 + * otherwise we'll soon end up with an empty buffer pool.
2162 + */
2163 + dpa_fd_release(net_dev, &dq->fd);
2164 + else
2165 + _dpa_rx_error(net_dev, priv, percpu_priv, &dq->fd, fq->fqid);
2166 +
2167 + return qman_cb_dqrr_consume;
2168 +}
2169 +
2170 +
2171 +enum qman_cb_dqrr_result __hot
2172 +priv_rx_default_dqrr(struct qman_portal *portal,
2173 + struct qman_fq *fq,
2174 + const struct qm_dqrr_entry *dq)
2175 +{
2176 + struct net_device *net_dev;
2177 + struct dpa_priv_s *priv;
2178 + struct dpa_percpu_priv_s *percpu_priv;
2179 + int *count_ptr;
2180 + struct dpa_bp *dpa_bp;
2181 +
2182 + net_dev = ((struct dpa_fq *)fq)->net_dev;
2183 + priv = netdev_priv(net_dev);
2184 + dpa_bp = priv->dpa_bp;
2185 +
2186 + /* Trace the Rx fd */
2187 + trace_dpa_rx_fd(net_dev, fq, &dq->fd);
2188 +
2189 + /* IRQ handler, non-migratable; safe to use raw_cpu_ptr here */
2190 + percpu_priv = raw_cpu_ptr(priv->percpu_priv);
2191 + count_ptr = raw_cpu_ptr(dpa_bp->percpu_count);
2192 +
2193 + if (unlikely(dpaa_eth_napi_schedule(percpu_priv, portal)))
2194 + return qman_cb_dqrr_stop;
2195 +
2196 + /* Vale of plenty: make sure we didn't run out of buffers */
2197 +
2198 + if (unlikely(dpaa_eth_refill_bpools(dpa_bp, count_ptr)))
2199 + /* Unable to refill the buffer pool due to insufficient
2200 + * system memory. Just release the frame back into the pool,
2201 + * otherwise we'll soon end up with an empty buffer pool.
2202 + */
2203 + dpa_fd_release(net_dev, &dq->fd);
2204 + else
2205 + _dpa_rx(net_dev, portal, priv, percpu_priv, &dq->fd, fq->fqid,
2206 + count_ptr);
2207 +
2208 + return qman_cb_dqrr_consume;
2209 +}
2210 +
2211 +enum qman_cb_dqrr_result
2212 +priv_tx_conf_error_dqrr(struct qman_portal *portal,
2213 + struct qman_fq *fq,
2214 + const struct qm_dqrr_entry *dq)
2215 +{
2216 + struct net_device *net_dev;
2217 + struct dpa_priv_s *priv;
2218 + struct dpa_percpu_priv_s *percpu_priv;
2219 +
2220 + net_dev = ((struct dpa_fq *)fq)->net_dev;
2221 + priv = netdev_priv(net_dev);
2222 +
2223 + percpu_priv = raw_cpu_ptr(priv->percpu_priv);
2224 +
2225 + if (dpaa_eth_napi_schedule(percpu_priv, portal))
2226 + return qman_cb_dqrr_stop;
2227 +
2228 + _dpa_tx_error(net_dev, priv, percpu_priv, &dq->fd, fq->fqid);
2229 +
2230 + return qman_cb_dqrr_consume;
2231 +}
2232 +
2233 +enum qman_cb_dqrr_result __hot
2234 +priv_tx_conf_default_dqrr(struct qman_portal *portal,
2235 + struct qman_fq *fq,
2236 + const struct qm_dqrr_entry *dq)
2237 +{
2238 + struct net_device *net_dev;
2239 + struct dpa_priv_s *priv;
2240 + struct dpa_percpu_priv_s *percpu_priv;
2241 +
2242 + net_dev = ((struct dpa_fq *)fq)->net_dev;
2243 + priv = netdev_priv(net_dev);
2244 +
2245 + /* Trace the fd */
2246 + trace_dpa_tx_conf_fd(net_dev, fq, &dq->fd);
2247 +
2248 + /* Non-migratable context, safe to use raw_cpu_ptr */
2249 + percpu_priv = raw_cpu_ptr(priv->percpu_priv);
2250 +
2251 + if (dpaa_eth_napi_schedule(percpu_priv, portal))
2252 + return qman_cb_dqrr_stop;
2253 +
2254 + _dpa_tx_conf(net_dev, priv, percpu_priv, &dq->fd, fq->fqid);
2255 +
2256 + return qman_cb_dqrr_consume;
2257 +}
2258 +
2259 +void priv_ern(struct qman_portal *portal,
2260 + struct qman_fq *fq,
2261 + const struct qm_mr_entry *msg)
2262 +{
2263 + struct net_device *net_dev;
2264 + const struct dpa_priv_s *priv;
2265 + struct sk_buff *skb;
2266 + struct dpa_percpu_priv_s *percpu_priv;
2267 + struct qm_fd fd = msg->ern.fd;
2268 +
2269 + net_dev = ((struct dpa_fq *)fq)->net_dev;
2270 + priv = netdev_priv(net_dev);
2271 + /* Non-migratable context, safe to use raw_cpu_ptr */
2272 + percpu_priv = raw_cpu_ptr(priv->percpu_priv);
2273 +
2274 + percpu_priv->stats.tx_dropped++;
2275 + percpu_priv->stats.tx_fifo_errors++;
2276 + count_ern(percpu_priv, msg);
2277 +
2278 + /* If we intended this buffer to go into the pool
2279 + * when the FM was done, we need to put it in
2280 + * manually.
2281 + */
2282 + if (msg->ern.fd.bpid != 0xff) {
2283 + dpa_fd_release(net_dev, &fd);
2284 + return;
2285 + }
2286 +
2287 + skb = _dpa_cleanup_tx_fd(priv, &fd);
2288 + dev_kfree_skb_any(skb);
2289 +}
2290 +
2291 +const struct dpa_fq_cbs_t private_fq_cbs = {
2292 + .rx_defq = { .cb = { .dqrr = priv_rx_default_dqrr } },
2293 + .tx_defq = { .cb = { .dqrr = priv_tx_conf_default_dqrr } },
2294 + .rx_errq = { .cb = { .dqrr = priv_rx_error_dqrr } },
2295 + .tx_errq = { .cb = { .dqrr = priv_tx_conf_error_dqrr } },
2296 + .egress_ern = { .cb = { .ern = priv_ern } }
2297 +};
2298 +EXPORT_SYMBOL(private_fq_cbs);
2299 +
2300 +static void dpaa_eth_napi_enable(struct dpa_priv_s *priv)
2301 +{
2302 + struct dpa_percpu_priv_s *percpu_priv;
2303 + int i, j;
2304 +
2305 + for_each_possible_cpu(i) {
2306 + percpu_priv = per_cpu_ptr(priv->percpu_priv, i);
2307 +
2308 + for (j = 0; j < qman_portal_max; j++)
2309 + napi_enable(&percpu_priv->np[j].napi);
2310 + }
2311 +}
2312 +
2313 +static void dpaa_eth_napi_disable(struct dpa_priv_s *priv)
2314 +{
2315 + struct dpa_percpu_priv_s *percpu_priv;
2316 + int i, j;
2317 +
2318 + for_each_possible_cpu(i) {
2319 + percpu_priv = per_cpu_ptr(priv->percpu_priv, i);
2320 +
2321 + for (j = 0; j < qman_portal_max; j++)
2322 + napi_disable(&percpu_priv->np[j].napi);
2323 + }
2324 +}
2325 +
2326 +static int __cold dpa_eth_priv_start(struct net_device *net_dev)
2327 +{
2328 + int err;
2329 + struct dpa_priv_s *priv;
2330 +
2331 + priv = netdev_priv(net_dev);
2332 +
2333 + dpaa_eth_napi_enable(priv);
2334 +
2335 + err = dpa_start(net_dev);
2336 + if (err < 0)
2337 + dpaa_eth_napi_disable(priv);
2338 +
2339 + return err;
2340 +}
2341 +
2342 +
2343 +
2344 +static int __cold dpa_eth_priv_stop(struct net_device *net_dev)
2345 +{
2346 + int _errno;
2347 + struct dpa_priv_s *priv;
2348 +
2349 + _errno = dpa_stop(net_dev);
2350 + /* Allow NAPI to consume any frame still in the Rx/TxConfirm
2351 + * ingress queues. This is to avoid a race between the current
2352 + * context and ksoftirqd which could leave NAPI disabled while
2353 + * in fact there's still Rx traffic to be processed.
2354 + */
2355 + usleep_range(5000, 10000);
2356 +
2357 + priv = netdev_priv(net_dev);
2358 + dpaa_eth_napi_disable(priv);
2359 +
2360 + return _errno;
2361 +}
2362 +
2363 +#ifdef CONFIG_NET_POLL_CONTROLLER
2364 +static void dpaa_eth_poll_controller(struct net_device *net_dev)
2365 +{
2366 + struct dpa_priv_s *priv = netdev_priv(net_dev);
2367 + struct dpa_percpu_priv_s *percpu_priv =
2368 + raw_cpu_ptr(priv->percpu_priv);
2369 + struct qman_portal *p;
2370 + const struct qman_portal_config *pc;
2371 + struct dpa_napi_portal *np;
2372 +
2373 + p = (struct qman_portal *)qman_get_affine_portal(smp_processor_id());
2374 + pc = qman_p_get_portal_config(p);
2375 + np = &percpu_priv->np[pc->index];
2376 +
2377 + qman_p_irqsource_remove(np->p, QM_PIRQ_DQRI);
2378 + qman_p_poll_dqrr(np->p, np->napi.weight);
2379 + qman_p_irqsource_add(np->p, QM_PIRQ_DQRI);
2380 +}
2381 +#endif
2382 +
2383 +static const struct net_device_ops dpa_private_ops = {
2384 + .ndo_open = dpa_eth_priv_start,
2385 + .ndo_start_xmit = dpa_tx,
2386 + .ndo_stop = dpa_eth_priv_stop,
2387 + .ndo_tx_timeout = dpa_timeout,
2388 + .ndo_get_stats64 = dpa_get_stats64,
2389 + .ndo_set_mac_address = dpa_set_mac_address,
2390 + .ndo_validate_addr = eth_validate_addr,
2391 +#ifdef CONFIG_FSL_DPAA_ETH_USE_NDO_SELECT_QUEUE
2392 + .ndo_select_queue = dpa_select_queue,
2393 +#endif
2394 + .ndo_change_mtu = dpa_change_mtu,
2395 + .ndo_set_rx_mode = dpa_set_rx_mode,
2396 + .ndo_init = dpa_ndo_init,
2397 + .ndo_set_features = dpa_set_features,
2398 + .ndo_fix_features = dpa_fix_features,
2399 + .ndo_do_ioctl = dpa_ioctl,
2400 +#ifdef CONFIG_NET_POLL_CONTROLLER
2401 + .ndo_poll_controller = dpaa_eth_poll_controller,
2402 +#endif
2403 +};
2404 +
2405 +static int dpa_private_napi_add(struct net_device *net_dev)
2406 +{
2407 + struct dpa_priv_s *priv = netdev_priv(net_dev);
2408 + struct dpa_percpu_priv_s *percpu_priv;
2409 + int i, cpu;
2410 +
2411 + for_each_possible_cpu(cpu) {
2412 + percpu_priv = per_cpu_ptr(priv->percpu_priv, cpu);
2413 +
2414 + percpu_priv->np = devm_kzalloc(net_dev->dev.parent,
2415 + qman_portal_max * sizeof(struct dpa_napi_portal),
2416 + GFP_KERNEL);
2417 +
2418 + if (unlikely(percpu_priv->np == NULL)) {
2419 + dev_err(net_dev->dev.parent, "devm_kzalloc() failed\n");
2420 + return -ENOMEM;
2421 + }
2422 +
2423 + for (i = 0; i < qman_portal_max; i++)
2424 + netif_napi_add(net_dev, &percpu_priv->np[i].napi,
2425 + dpaa_eth_poll, DPA_NAPI_WEIGHT);
2426 + }
2427 +
2428 + return 0;
2429 +}
2430 +
2431 +void dpa_private_napi_del(struct net_device *net_dev)
2432 +{
2433 + struct dpa_priv_s *priv = netdev_priv(net_dev);
2434 + struct dpa_percpu_priv_s *percpu_priv;
2435 + int i, cpu;
2436 +
2437 + for_each_possible_cpu(cpu) {
2438 + percpu_priv = per_cpu_ptr(priv->percpu_priv, cpu);
2439 +
2440 + if (percpu_priv->np) {
2441 + for (i = 0; i < qman_portal_max; i++)
2442 + netif_napi_del(&percpu_priv->np[i].napi);
2443 +
2444 + devm_kfree(net_dev->dev.parent, percpu_priv->np);
2445 + }
2446 + }
2447 +}
2448 +EXPORT_SYMBOL(dpa_private_napi_del);
2449 +
2450 +static int dpa_private_netdev_init(struct net_device *net_dev)
2451 +{
2452 + int i;
2453 + struct dpa_priv_s *priv = netdev_priv(net_dev);
2454 + struct dpa_percpu_priv_s *percpu_priv;
2455 + const uint8_t *mac_addr;
2456 +
2457 + /* Although we access another CPU's private data here
2458 + * we do it at initialization so it is safe
2459 + */
2460 + for_each_possible_cpu(i) {
2461 + percpu_priv = per_cpu_ptr(priv->percpu_priv, i);
2462 + percpu_priv->net_dev = net_dev;
2463 + }
2464 +
2465 + net_dev->netdev_ops = &dpa_private_ops;
2466 + mac_addr = priv->mac_dev->addr;
2467 +
2468 + net_dev->mem_start = priv->mac_dev->res->start;
2469 + net_dev->mem_end = priv->mac_dev->res->end;
2470 +
2471 + net_dev->hw_features |= (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
2472 + NETIF_F_LLTX);
2473 +
2474 + /* Advertise S/G and HIGHDMA support for private interfaces */
2475 + net_dev->hw_features |= NETIF_F_SG | NETIF_F_HIGHDMA;
2476 + /* Recent kernels enable GSO automatically, if
2477 + * we declare NETIF_F_SG. For conformity, we'll
2478 + * still declare GSO explicitly.
2479 + */
2480 + net_dev->features |= NETIF_F_GSO;
2481 +
2482 + /* Advertise GRO support */
2483 + net_dev->features |= NETIF_F_GRO;
2484 +
2485 + /* Advertise NETIF_F_HW_ACCEL_MQ to avoid Tx timeout warnings */
2486 + net_dev->features |= NETIF_F_HW_ACCEL_MQ;
2487 +
2488 + return dpa_netdev_init(net_dev, mac_addr, tx_timeout);
2489 +}
2490 +
2491 +static struct dpa_bp * __cold
2492 +dpa_priv_bp_probe(struct device *dev)
2493 +{
2494 + struct dpa_bp *dpa_bp;
2495 +
2496 + dpa_bp = devm_kzalloc(dev, sizeof(*dpa_bp), GFP_KERNEL);
2497 + if (unlikely(dpa_bp == NULL)) {
2498 + dev_err(dev, "devm_kzalloc() failed\n");
2499 + return ERR_PTR(-ENOMEM);
2500 + }
2501 +
2502 + dpa_bp->percpu_count = devm_alloc_percpu(dev, *dpa_bp->percpu_count);
2503 + dpa_bp->target_count = CONFIG_FSL_DPAA_ETH_MAX_BUF_COUNT;
2504 +
2505 + dpa_bp->seed_cb = dpa_bp_priv_seed;
2506 + dpa_bp->free_buf_cb = _dpa_bp_free_pf;
2507 +
2508 + return dpa_bp;
2509 +}
2510 +
2511 +/* Place all ingress FQs (Rx Default, Rx Error, PCD FQs) in a dedicated CGR.
2512 + * We won't be sending congestion notifications to FMan; for now, we just use
2513 + * this CGR to generate enqueue rejections to FMan in order to drop the frames
2514 + * before they reach our ingress queues and eat up memory.
2515 + */
2516 +static int dpaa_eth_priv_ingress_cgr_init(struct dpa_priv_s *priv)
2517 +{
2518 + struct qm_mcc_initcgr initcgr;
2519 + u32 cs_th;
2520 + int err;
2521 +
2522 + err = qman_alloc_cgrid(&priv->ingress_cgr.cgrid);
2523 + if (err < 0) {
2524 + pr_err("Error %d allocating CGR ID\n", err);
2525 + goto out_error;
2526 + }
2527 +
2528 + /* Enable CS TD, but disable Congestion State Change Notifications. */
2529 + initcgr.we_mask = QM_CGR_WE_CS_THRES;
2530 + initcgr.cgr.cscn_en = QM_CGR_EN;
2531 + cs_th = CONFIG_FSL_DPAA_INGRESS_CS_THRESHOLD;
2532 + qm_cgr_cs_thres_set64(&initcgr.cgr.cs_thres, cs_th, 1);
2533 +
2534 + initcgr.we_mask |= QM_CGR_WE_CSTD_EN;
2535 + initcgr.cgr.cstd_en = QM_CGR_EN;
2536 +
2537 + /* This is actually a hack, because this CGR will be associated with
2538 + * our affine SWP. However, we'll place our ingress FQs in it.
2539 + */
2540 + err = qman_create_cgr(&priv->ingress_cgr, QMAN_CGR_FLAG_USE_INIT,
2541 + &initcgr);
2542 + if (err < 0) {
2543 + pr_err("Error %d creating ingress CGR with ID %d\n", err,
2544 + priv->ingress_cgr.cgrid);
2545 + qman_release_cgrid(priv->ingress_cgr.cgrid);
2546 + goto out_error;
2547 + }
2548 + pr_debug("Created ingress CGR %d for netdev with hwaddr %pM\n",
2549 + priv->ingress_cgr.cgrid, priv->mac_dev->addr);
2550 +
2551 + /* struct qman_cgr allows special cgrid values (i.e. outside the 0..255
2552 + * range), but we have no common initialization path between the
2553 + * different variants of the DPAA Eth driver, so we do it here rather
2554 + * than modifying every other variant than "private Eth".
2555 + */
2556 + priv->use_ingress_cgr = true;
2557 +
2558 +out_error:
2559 + return err;
2560 +}
2561 +
2562 +static int dpa_priv_bp_create(struct net_device *net_dev, struct dpa_bp *dpa_bp,
2563 + size_t count)
2564 +{
2565 + struct dpa_priv_s *priv = netdev_priv(net_dev);
2566 + int i;
2567 +
2568 + if (netif_msg_probe(priv))
2569 + dev_dbg(net_dev->dev.parent,
2570 + "Using private BM buffer pools\n");
2571 +
2572 + priv->bp_count = count;
2573 +
2574 + for (i = 0; i < count; i++) {
2575 + int err;
2576 + err = dpa_bp_alloc(&dpa_bp[i]);
2577 + if (err < 0) {
2578 + dpa_bp_free(priv);
2579 + priv->dpa_bp = NULL;
2580 + return err;
2581 + }
2582 +
2583 + priv->dpa_bp = &dpa_bp[i];
2584 + }
2585 +
2586 + dpa_priv_common_bpid = priv->dpa_bp->bpid;
2587 + return 0;
2588 +}
2589 +
2590 +static const struct of_device_id dpa_match[];
2591 +
2592 +#ifdef CONFIG_FSL_DPAA_DBG_LOOP
2593 +static int dpa_new_loop_id(void)
2594 +{
2595 + static int if_id;
2596 +
2597 + return if_id++;
2598 +}
2599 +#endif
2600 +
2601 +static int
2602 +dpaa_eth_priv_probe(struct platform_device *_of_dev)
2603 +{
2604 + int err = 0, i, channel;
2605 + struct device *dev;
2606 + struct device_node *dpa_node;
2607 + struct dpa_bp *dpa_bp;
2608 + size_t count = 1;
2609 + struct net_device *net_dev = NULL;
2610 + struct dpa_priv_s *priv = NULL;
2611 + struct dpa_percpu_priv_s *percpu_priv;
2612 + struct fm_port_fqs port_fqs;
2613 + struct dpa_buffer_layout_s *buf_layout = NULL;
2614 + struct mac_device *mac_dev;
2615 +
2616 + dev = &_of_dev->dev;
2617 +
2618 + dpa_node = dev->of_node;
2619 +
2620 + if (!of_device_is_available(dpa_node))
2621 + return -ENODEV;
2622 +
2623 + /* Get the buffer pools assigned to this interface;
2624 + * run only once the default pool probing code
2625 + */
2626 + dpa_bp = (dpa_bpid2pool(dpa_priv_common_bpid)) ? :
2627 + dpa_priv_bp_probe(dev);
2628 + if (IS_ERR(dpa_bp))
2629 + return PTR_ERR(dpa_bp);
2630 +
2631 + /* Allocate this early, so we can store relevant information in
2632 + * the private area (needed by 1588 code in dpa_mac_probe)
2633 + */
2634 + net_dev = alloc_etherdev_mq(sizeof(*priv), DPAA_ETH_TX_QUEUES);
2635 + if (!net_dev) {
2636 + dev_err(dev, "alloc_etherdev_mq() failed\n");
2637 + goto alloc_etherdev_mq_failed;
2638 + }
2639 +
2640 + /* Do this here, so we can be verbose early */
2641 + SET_NETDEV_DEV(net_dev, dev);
2642 + dev_set_drvdata(dev, net_dev);
2643 +
2644 + priv = netdev_priv(net_dev);
2645 + priv->net_dev = net_dev;
2646 + strcpy(priv->if_type, "private");
2647 +
2648 + priv->msg_enable = netif_msg_init(debug, -1);
2649 +
2650 +#ifdef CONFIG_FSL_DPAA_DBG_LOOP
2651 + priv->loop_id = dpa_new_loop_id();
2652 + priv->loop_to = -1; /* disabled by default */
2653 + dpa_loop_netdevs[priv->loop_id] = net_dev;
2654 +#endif
2655 +
2656 + mac_dev = dpa_mac_probe(_of_dev);
2657 + if (IS_ERR(mac_dev) || !mac_dev) {
2658 + err = PTR_ERR(mac_dev);
2659 + goto mac_probe_failed;
2660 + }
2661 +
2662 + /* We have physical ports, so we need to establish
2663 + * the buffer layout.
2664 + */
2665 + buf_layout = devm_kzalloc(dev, 2 * sizeof(*buf_layout),
2666 + GFP_KERNEL);
2667 + if (!buf_layout) {
2668 + dev_err(dev, "devm_kzalloc() failed\n");
2669 + goto alloc_failed;
2670 + }
2671 + dpa_set_buffers_layout(mac_dev, buf_layout);
2672 +
2673 + /* For private ports, need to compute the size of the default
2674 + * buffer pool, based on FMan port buffer layout;also update
2675 + * the maximum buffer size for private ports if necessary
2676 + */
2677 + dpa_bp->size = dpa_bp_size(&buf_layout[RX]);
2678 +
2679 +#ifdef CONFIG_FSL_DPAA_ETH_JUMBO_FRAME
2680 + /* We only want to use jumbo frame optimization if we actually have
2681 + * L2 MAX FRM set for jumbo frames as well.
2682 + */
2683 +#ifndef CONFIG_PPC
2684 + if (likely(!dpaa_errata_a010022))
2685 +#endif
2686 + if(fm_get_max_frm() < 9600)
2687 + dev_warn(dev,
2688 + "Invalid configuration: if jumbo frames support is on, FSL_FM_MAX_FRAME_SIZE should be set to 9600\n");
2689 +#endif
2690 +
2691 + INIT_LIST_HEAD(&priv->dpa_fq_list);
2692 +
2693 + memset(&port_fqs, 0, sizeof(port_fqs));
2694 +
2695 + err = dpa_fq_probe_mac(dev, &priv->dpa_fq_list, &port_fqs, true, RX);
2696 + if (!err)
2697 + err = dpa_fq_probe_mac(dev, &priv->dpa_fq_list,
2698 + &port_fqs, true, TX);
2699 +
2700 + if (err < 0)
2701 + goto fq_probe_failed;
2702 +
2703 + /* bp init */
2704 +
2705 + err = dpa_priv_bp_create(net_dev, dpa_bp, count);
2706 +
2707 + if (err < 0)
2708 + goto bp_create_failed;
2709 +
2710 + priv->mac_dev = mac_dev;
2711 +
2712 + channel = dpa_get_channel();
2713 +
2714 + if (channel < 0) {
2715 + err = channel;
2716 + goto get_channel_failed;
2717 + }
2718 +
2719 + priv->channel = (uint16_t)channel;
2720 + dpaa_eth_add_channel(priv->channel);
2721 +
2722 + dpa_fq_setup(priv, &private_fq_cbs, priv->mac_dev->port_dev[TX]);
2723 +
2724 + /* Create a congestion group for this netdev, with
2725 + * dynamically-allocated CGR ID.
2726 + * Must be executed after probing the MAC, but before
2727 + * assigning the egress FQs to the CGRs.
2728 + */
2729 + err = dpaa_eth_cgr_init(priv);
2730 + if (err < 0) {
2731 + dev_err(dev, "Error initializing CGR\n");
2732 + goto tx_cgr_init_failed;
2733 + }
2734 + err = dpaa_eth_priv_ingress_cgr_init(priv);
2735 + if (err < 0) {
2736 + dev_err(dev, "Error initializing ingress CGR\n");
2737 + goto rx_cgr_init_failed;
2738 + }
2739 +
2740 + /* Add the FQs to the interface, and make them active */
2741 + err = dpa_fqs_init(dev, &priv->dpa_fq_list, false);
2742 + if (err < 0)
2743 + goto fq_alloc_failed;
2744 +
2745 + priv->buf_layout = buf_layout;
2746 + priv->tx_headroom = dpa_get_headroom(&priv->buf_layout[TX]);
2747 + priv->rx_headroom = dpa_get_headroom(&priv->buf_layout[RX]);
2748 +
2749 + /* All real interfaces need their ports initialized */
2750 + dpaa_eth_init_ports(mac_dev, dpa_bp, count, &port_fqs,
2751 + buf_layout, dev);
2752 +
2753 +#ifdef CONFIG_FMAN_PFC
2754 + for (i = 0; i < CONFIG_FMAN_PFC_COS_COUNT; i++) {
2755 + err = fm_port_set_pfc_priorities_mapping_to_qman_wq(
2756 + mac_dev->port_dev[TX], i, i);
2757 + if (unlikely(err != 0)) {
2758 + dev_err(dev, "Error maping PFC %u to WQ %u\n", i, i);
2759 + goto pfc_mapping_failed;
2760 + }
2761 + }
2762 +#endif
2763 +
2764 + priv->percpu_priv = devm_alloc_percpu(dev, *priv->percpu_priv);
2765 +
2766 + if (priv->percpu_priv == NULL) {
2767 + dev_err(dev, "devm_alloc_percpu() failed\n");
2768 + err = -ENOMEM;
2769 + goto alloc_percpu_failed;
2770 + }
2771 + for_each_possible_cpu(i) {
2772 + percpu_priv = per_cpu_ptr(priv->percpu_priv, i);
2773 + memset(percpu_priv, 0, sizeof(*percpu_priv));
2774 + }
2775 +
2776 + /* Initialize NAPI */
2777 + err = dpa_private_napi_add(net_dev);
2778 +
2779 + if (err < 0)
2780 + goto napi_add_failed;
2781 +
2782 + err = dpa_private_netdev_init(net_dev);
2783 +
2784 + if (err < 0)
2785 + goto netdev_init_failed;
2786 +
2787 + dpaa_eth_sysfs_init(&net_dev->dev);
2788 +
2789 +#ifdef CONFIG_PM
2790 + device_set_wakeup_capable(dev, true);
2791 +#endif
2792 +
2793 + pr_info("fsl_dpa: Probed interface %s\n", net_dev->name);
2794 +
2795 + return 0;
2796 +
2797 +netdev_init_failed:
2798 +napi_add_failed:
2799 + dpa_private_napi_del(net_dev);
2800 +alloc_percpu_failed:
2801 +#ifdef CONFIG_FMAN_PFC
2802 +pfc_mapping_failed:
2803 +#endif
2804 + dpa_fq_free(dev, &priv->dpa_fq_list);
2805 +fq_alloc_failed:
2806 + qman_delete_cgr_safe(&priv->ingress_cgr);
2807 + qman_release_cgrid(priv->ingress_cgr.cgrid);
2808 +rx_cgr_init_failed:
2809 + qman_delete_cgr_safe(&priv->cgr_data.cgr);
2810 + qman_release_cgrid(priv->cgr_data.cgr.cgrid);
2811 +tx_cgr_init_failed:
2812 +get_channel_failed:
2813 + dpa_bp_free(priv);
2814 +bp_create_failed:
2815 +fq_probe_failed:
2816 +alloc_failed:
2817 +mac_probe_failed:
2818 + dev_set_drvdata(dev, NULL);
2819 + free_netdev(net_dev);
2820 +alloc_etherdev_mq_failed:
2821 + if (atomic_read(&dpa_bp->refs) == 0)
2822 + devm_kfree(dev, dpa_bp);
2823 +
2824 + return err;
2825 +}
2826 +
2827 +static const struct of_device_id dpa_match[] = {
2828 + {
2829 + .compatible = "fsl,dpa-ethernet"
2830 + },
2831 + {}
2832 +};
2833 +MODULE_DEVICE_TABLE(of, dpa_match);
2834 +
2835 +static struct platform_driver dpa_driver = {
2836 + .driver = {
2837 + .name = KBUILD_MODNAME,
2838 + .of_match_table = dpa_match,
2839 + .owner = THIS_MODULE,
2840 + .pm = DPAA_PM_OPS,
2841 + },
2842 + .probe = dpaa_eth_priv_probe,
2843 + .remove = dpa_remove
2844 +};
2845 +
2846 +#ifndef CONFIG_PPC
2847 +static bool __init __cold soc_has_errata_a010022(void)
2848 +{
2849 +#ifdef CONFIG_SOC_BUS
2850 + const struct soc_device_attribute soc_msi_matches[] = {
2851 + { .family = "QorIQ LS1043A",
2852 + .data = NULL },
2853 + { },
2854 + };
2855 +
2856 + if (soc_device_match(soc_msi_matches))
2857 + return true;
2858 +
2859 + return false;
2860 +#else
2861 + return true; /* cannot identify SoC */
2862 +#endif
2863 +}
2864 +#endif
2865 +
2866 +static int __init __cold dpa_load(void)
2867 +{
2868 + int _errno;
2869 +
2870 + pr_info(DPA_DESCRIPTION "\n");
2871 +
2872 +#ifdef CONFIG_FSL_DPAA_DBG_LOOP
2873 + dpa_debugfs_module_init();
2874 +#endif /* CONFIG_FSL_DPAA_DBG_LOOP */
2875 +
2876 + /* initialise dpaa_eth mirror values */
2877 + dpa_rx_extra_headroom = fm_get_rx_extra_headroom();
2878 + dpa_max_frm = fm_get_max_frm();
2879 + dpa_num_cpus = num_possible_cpus();
2880 +
2881 +#ifndef CONFIG_PPC
2882 + /* Detect if the current SoC requires the 4K alignment workaround */
2883 + dpaa_errata_a010022 = soc_has_errata_a010022();
2884 +#endif
2885 +
2886 +#ifdef CONFIG_FSL_DPAA_DBG_LOOP
2887 + memset(dpa_loop_netdevs, 0, sizeof(dpa_loop_netdevs));
2888 +#endif
2889 +
2890 + _errno = platform_driver_register(&dpa_driver);
2891 + if (unlikely(_errno < 0)) {
2892 + pr_err(KBUILD_MODNAME
2893 + ": %s:%hu:%s(): platform_driver_register() = %d\n",
2894 + KBUILD_BASENAME".c", __LINE__, __func__, _errno);
2895 + }
2896 +
2897 + pr_debug(KBUILD_MODNAME ": %s:%s() ->\n",
2898 + KBUILD_BASENAME".c", __func__);
2899 +
2900 + return _errno;
2901 +}
2902 +module_init(dpa_load);
2903 +
2904 +static void __exit __cold dpa_unload(void)
2905 +{
2906 + pr_debug(KBUILD_MODNAME ": -> %s:%s()\n",
2907 + KBUILD_BASENAME".c", __func__);
2908 +
2909 + platform_driver_unregister(&dpa_driver);
2910 +
2911 +#ifdef CONFIG_FSL_DPAA_DBG_LOOP
2912 + dpa_debugfs_module_exit();
2913 +#endif /* CONFIG_FSL_DPAA_DBG_LOOP */
2914 +
2915 + /* Only one channel is used and needs to be relased after all
2916 + * interfaces are removed
2917 + */
2918 + dpa_release_channel();
2919 +
2920 + pr_debug(KBUILD_MODNAME ": %s:%s() ->\n",
2921 + KBUILD_BASENAME".c", __func__);
2922 +}
2923 +module_exit(dpa_unload);
2924 --- /dev/null
2925 +++ b/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth.h
2926 @@ -0,0 +1,687 @@
2927 +/* Copyright 2008-2012 Freescale Semiconductor Inc.
2928 + *
2929 + * Redistribution and use in source and binary forms, with or without
2930 + * modification, are permitted provided that the following conditions are met:
2931 + * * Redistributions of source code must retain the above copyright
2932 + * notice, this list of conditions and the following disclaimer.
2933 + * * Redistributions in binary form must reproduce the above copyright
2934 + * notice, this list of conditions and the following disclaimer in the
2935 + * documentation and/or other materials provided with the distribution.
2936 + * * Neither the name of Freescale Semiconductor nor the
2937 + * names of its contributors may be used to endorse or promote products
2938 + * derived from this software without specific prior written permission.
2939 + *
2940 + *
2941 + * ALTERNATIVELY, this software may be distributed under the terms of the
2942 + * GNU General Public License ("GPL") as published by the Free Software
2943 + * Foundation, either version 2 of that License or (at your option) any
2944 + * later version.
2945 + *
2946 + * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
2947 + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
2948 + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
2949 + * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
2950 + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
2951 + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
2952 + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
2953 + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2954 + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
2955 + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2956 + */
2957 +
2958 +#ifndef __DPA_H
2959 +#define __DPA_H
2960 +
2961 +#include <linux/netdevice.h>
2962 +#include <linux/fsl_qman.h> /* struct qman_fq */
2963 +
2964 +#include "fm_ext.h"
2965 +#include "dpaa_eth_trace.h"
2966 +
2967 +extern int dpa_rx_extra_headroom;
2968 +extern int dpa_max_frm;
2969 +extern int dpa_num_cpus;
2970 +
2971 +#define dpa_get_rx_extra_headroom() dpa_rx_extra_headroom
2972 +#define dpa_get_max_frm() dpa_max_frm
2973 +
2974 +#define dpa_get_max_mtu() \
2975 + (dpa_get_max_frm() - (VLAN_ETH_HLEN + ETH_FCS_LEN))
2976 +
2977 +#define __hot
2978 +
2979 +/* Simple enum of FQ types - used for array indexing */
2980 +enum port_type {RX, TX};
2981 +
2982 +/* TODO: This structure should be renamed & moved to the FMD wrapper */
2983 +struct dpa_buffer_layout_s {
2984 + uint16_t priv_data_size;
2985 + bool parse_results;
2986 + bool time_stamp;
2987 + bool hash_results;
2988 + uint8_t manip_extra_space;
2989 + uint16_t data_align;
2990 +};
2991 +
2992 +#ifdef CONFIG_FSL_DPAA_ETH_DEBUG
2993 +#define DPA_BUG_ON(cond) BUG_ON(cond)
2994 +#else
2995 +#define DPA_BUG_ON(cond)
2996 +#endif
2997 +
2998 +#define DPA_TX_PRIV_DATA_SIZE 16
2999 +#define DPA_PARSE_RESULTS_SIZE sizeof(fm_prs_result_t)
3000 +#define DPA_TIME_STAMP_SIZE 8
3001 +#define DPA_HASH_RESULTS_SIZE 8
3002 +#define DPA_RX_PRIV_DATA_SIZE (DPA_TX_PRIV_DATA_SIZE + \
3003 + dpa_get_rx_extra_headroom())
3004 +
3005 +#define FM_FD_STAT_RX_ERRORS \
3006 + (FM_PORT_FRM_ERR_DMA | FM_PORT_FRM_ERR_PHYSICAL | \
3007 + FM_PORT_FRM_ERR_SIZE | FM_PORT_FRM_ERR_CLS_DISCARD | \
3008 + FM_PORT_FRM_ERR_EXTRACTION | FM_PORT_FRM_ERR_NO_SCHEME | \
3009 + FM_PORT_FRM_ERR_ILL_PLCR | FM_PORT_FRM_ERR_PRS_TIMEOUT | \
3010 + FM_PORT_FRM_ERR_PRS_ILL_INSTRUCT | FM_PORT_FRM_ERR_PRS_HDR_ERR)
3011 +
3012 +#define FM_FD_STAT_TX_ERRORS \
3013 + (FM_PORT_FRM_ERR_UNSUPPORTED_FORMAT | \
3014 + FM_PORT_FRM_ERR_LENGTH | FM_PORT_FRM_ERR_DMA)
3015 +
3016 +#ifndef CONFIG_FSL_DPAA_ETH_JUMBO_FRAME
3017 +/* The raw buffer size must be cacheline aligned.
3018 + * Normally we use 2K buffers.
3019 + */
3020 +#define DPA_BP_RAW_SIZE 2048
3021 +#else
3022 +/* For jumbo frame optimizations, use buffers large enough to accommodate
3023 + * 9.6K frames, FD maximum offset, skb sh_info overhead and some extra
3024 + * space to account for further alignments.
3025 + */
3026 +#define DPA_MAX_FRM_SIZE 9600
3027 +#ifdef CONFIG_PPC
3028 +#define DPA_BP_RAW_SIZE \
3029 + ((DPA_MAX_FRM_SIZE + DPA_MAX_FD_OFFSET + \
3030 + sizeof(struct skb_shared_info) + 128) & ~(SMP_CACHE_BYTES - 1))
3031 +#else /* CONFIG_PPC */
3032 +#define DPA_BP_RAW_SIZE ((unlikely(dpaa_errata_a010022)) ? 2048 : \
3033 + ((DPA_MAX_FRM_SIZE + DPA_MAX_FD_OFFSET + \
3034 + sizeof(struct skb_shared_info) + 128) & ~(SMP_CACHE_BYTES - 1)))
3035 +#endif /* CONFIG_PPC */
3036 +#endif /* CONFIG_FSL_DPAA_ETH_JUMBO_FRAME */
3037 +
3038 +/* This is what FMan is ever allowed to use.
3039 + * FMan-DMA requires 16-byte alignment for Rx buffers, but SKB_DATA_ALIGN is
3040 + * even stronger (SMP_CACHE_BYTES-aligned), so we just get away with that,
3041 + * via SKB_WITH_OVERHEAD(). We can't rely on netdev_alloc_frag() giving us
3042 + * half-page-aligned buffers (can we?), so we reserve some more space
3043 + * for start-of-buffer alignment.
3044 + */
3045 +#define dpa_bp_size(buffer_layout) (SKB_WITH_OVERHEAD(DPA_BP_RAW_SIZE) - \
3046 + SMP_CACHE_BYTES)
3047 +/* We must ensure that skb_shinfo is always cacheline-aligned. */
3048 +#define DPA_SKB_SIZE(size) ((size) & ~(SMP_CACHE_BYTES - 1))
3049 +
3050 +/* Maximum size of a buffer for which recycling is allowed.
3051 + * We need an upper limit such that forwarded skbs that get reallocated on Tx
3052 + * aren't allowed to grow unboundedly. On the other hand, we need to make sure
3053 + * that skbs allocated by us will not fail to be recycled due to their size.
3054 + *
3055 + * For a requested size, the kernel allocator provides the next power of two
3056 + * sized block, which the stack will use as is, regardless of the actual size
3057 + * it required; since we must accommodate at most 9.6K buffers (L2 maximum
3058 + * supported frame size), set the recycling upper limit to 16K.
3059 + */
3060 +#define DPA_RECYCLE_MAX_SIZE 16384
3061 +
3062 +#if defined(CONFIG_FSL_SDK_FMAN_TEST)
3063 +/*TODO: temporary for fman pcd testing */
3064 +#define FMAN_PCD_TESTS_MAX_NUM_RANGES 20
3065 +#endif
3066 +
3067 +#define DPAA_ETH_FQ_DELTA 0x10000
3068 +
3069 +#define DPAA_ETH_PCD_FQ_BASE(device_addr) \
3070 + (((device_addr) & 0x1fffff) >> 6)
3071 +
3072 +#define DPAA_ETH_PCD_FQ_HI_PRIO_BASE(device_addr) \
3073 + (DPAA_ETH_FQ_DELTA + DPAA_ETH_PCD_FQ_BASE(device_addr))
3074 +
3075 +/* Largest value that the FQD's OAL field can hold.
3076 + * This is DPAA-1.x specific.
3077 + * TODO: This rather belongs in fsl_qman.h
3078 + */
3079 +#define FSL_QMAN_MAX_OAL 127
3080 +
3081 +/* Maximum offset value for a contig or sg FD (represented on 9 bits) */
3082 +#define DPA_MAX_FD_OFFSET ((1 << 9) - 1)
3083 +
3084 +/* Default alignment for start of data in an Rx FD */
3085 +#define DPA_FD_DATA_ALIGNMENT 16
3086 +
3087 +/* Values for the L3R field of the FM Parse Results
3088 + */
3089 +/* L3 Type field: First IP Present IPv4 */
3090 +#define FM_L3_PARSE_RESULT_IPV4 0x8000
3091 +/* L3 Type field: First IP Present IPv6 */
3092 +#define FM_L3_PARSE_RESULT_IPV6 0x4000
3093 +
3094 +/* Values for the L4R field of the FM Parse Results
3095 + * See $8.8.4.7.20 - L4 HXS - L4 Results from DPAA-Rev2 Reference Manual.
3096 + */
3097 +/* L4 Type field: UDP */
3098 +#define FM_L4_PARSE_RESULT_UDP 0x40
3099 +/* L4 Type field: TCP */
3100 +#define FM_L4_PARSE_RESULT_TCP 0x20
3101 +/* FD status field indicating whether the FM Parser has attempted to validate
3102 + * the L4 csum of the frame.
3103 + * Note that having this bit set doesn't necessarily imply that the checksum
3104 + * is valid. One would have to check the parse results to find that out.
3105 + */
3106 +#define FM_FD_STAT_L4CV 0x00000004
3107 +
3108 +
3109 +#define FM_FD_STAT_ERR_PHYSICAL FM_PORT_FRM_ERR_PHYSICAL
3110 +
3111 +/* Check if the parsed frame was found to be a TCP segment.
3112 + *
3113 + * @parse_result_ptr must be of type (fm_prs_result_t *).
3114 + */
3115 +#define fm_l4_frame_is_tcp(parse_result_ptr) \
3116 + ((parse_result_ptr)->l4r & FM_L4_PARSE_RESULT_TCP)
3117 +
3118 +/* number of Tx queues to FMan */
3119 +#ifdef CONFIG_FMAN_PFC
3120 +#define DPAA_ETH_TX_QUEUES (NR_CPUS * CONFIG_FMAN_PFC_COS_COUNT)
3121 +#else
3122 +#define DPAA_ETH_TX_QUEUES NR_CPUS
3123 +#endif
3124 +
3125 +#define DPAA_ETH_RX_QUEUES 128
3126 +
3127 +/* Convenience macros for storing/retrieving the skb back-pointers. They must
3128 + * accommodate both recycling and confirmation paths - i.e. cases when the buf
3129 + * was allocated by ourselves, respectively by the stack. In the former case,
3130 + * we could store the skb at negative offset; in the latter case, we can't,
3131 + * so we'll use 0 as offset.
3132 + *
3133 + * NB: @off is an offset from a (struct sk_buff **) pointer!
3134 + */
3135 +#define DPA_WRITE_SKB_PTR(skb, skbh, addr, off) \
3136 +{ \
3137 + skbh = (struct sk_buff **)addr; \
3138 + *(skbh + (off)) = skb; \
3139 +}
3140 +#define DPA_READ_SKB_PTR(skb, skbh, addr, off) \
3141 +{ \
3142 + skbh = (struct sk_buff **)addr; \
3143 + skb = *(skbh + (off)); \
3144 +}
3145 +
3146 +#ifdef CONFIG_PM
3147 +/* Magic Packet wakeup */
3148 +#define DPAA_WOL_MAGIC 0x00000001
3149 +#endif
3150 +
3151 +#if defined(CONFIG_FSL_SDK_FMAN_TEST)
3152 +struct pcd_range {
3153 + uint32_t base;
3154 + uint32_t count;
3155 +};
3156 +#endif
3157 +
3158 +/* More detailed FQ types - used for fine-grained WQ assignments */
3159 +enum dpa_fq_type {
3160 + FQ_TYPE_RX_DEFAULT = 1, /* Rx Default FQs */
3161 + FQ_TYPE_RX_ERROR, /* Rx Error FQs */
3162 + FQ_TYPE_RX_PCD, /* User-defined PCDs */
3163 + FQ_TYPE_TX, /* "Real" Tx FQs */
3164 + FQ_TYPE_TX_CONFIRM, /* Tx default Conf FQ (actually an Rx FQ) */
3165 + FQ_TYPE_TX_CONF_MQ, /* Tx conf FQs (one for each Tx FQ) */
3166 + FQ_TYPE_TX_ERROR, /* Tx Error FQs (these are actually Rx FQs) */
3167 + FQ_TYPE_RX_PCD_HI_PRIO, /* User-defined high-priority PCDs */
3168 +};
3169 +
3170 +struct dpa_fq {
3171 + struct qman_fq fq_base;
3172 + struct list_head list;
3173 + struct net_device *net_dev;
3174 + bool init;
3175 + uint32_t fqid;
3176 + uint32_t flags;
3177 + uint16_t channel;
3178 + uint8_t wq;
3179 + enum dpa_fq_type fq_type;
3180 +};
3181 +
3182 +struct dpa_fq_cbs_t {
3183 + struct qman_fq rx_defq;
3184 + struct qman_fq tx_defq;
3185 + struct qman_fq rx_errq;
3186 + struct qman_fq tx_errq;
3187 + struct qman_fq egress_ern;
3188 +};
3189 +
3190 +struct fqid_cell {
3191 + uint32_t start;
3192 + uint32_t count;
3193 +};
3194 +
3195 +struct dpa_bp {
3196 + struct bman_pool *pool;
3197 + uint8_t bpid;
3198 + struct device *dev;
3199 + union {
3200 + /* The buffer pools used for the private ports are initialized
3201 + * with target_count buffers for each CPU; at runtime the
3202 + * number of buffers per CPU is constantly brought back to this
3203 + * level
3204 + */
3205 + int target_count;
3206 + /* The configured value for the number of buffers in the pool,
3207 + * used for shared port buffer pools
3208 + */
3209 + int config_count;
3210 + };
3211 + size_t size;
3212 + bool seed_pool;
3213 + /* physical address of the contiguous memory used by the pool to store
3214 + * the buffers
3215 + */
3216 + dma_addr_t paddr;
3217 + /* virtual address of the contiguous memory used by the pool to store
3218 + * the buffers
3219 + */
3220 + void __iomem *vaddr;
3221 + /* current number of buffers in the bpool alloted to this CPU */
3222 + int __percpu *percpu_count;
3223 + atomic_t refs;
3224 + /* some bpools need to be seeded before use by this cb */
3225 + int (*seed_cb)(struct dpa_bp *);
3226 + /* some bpools need to be emptied before freeing; this cb is used
3227 + * for freeing of individual buffers taken from the pool
3228 + */
3229 + void (*free_buf_cb)(void *addr);
3230 +};
3231 +
3232 +struct dpa_rx_errors {
3233 + u64 dme; /* DMA Error */
3234 + u64 fpe; /* Frame Physical Error */
3235 + u64 fse; /* Frame Size Error */
3236 + u64 phe; /* Header Error */
3237 + u64 cse; /* Checksum Validation Error */
3238 +};
3239 +
3240 +/* Counters for QMan ERN frames - one counter per rejection code */
3241 +struct dpa_ern_cnt {
3242 + u64 cg_tdrop; /* Congestion group taildrop */
3243 + u64 wred; /* WRED congestion */
3244 + u64 err_cond; /* Error condition */
3245 + u64 early_window; /* Order restoration, frame too early */
3246 + u64 late_window; /* Order restoration, frame too late */
3247 + u64 fq_tdrop; /* FQ taildrop */
3248 + u64 fq_retired; /* FQ is retired */
3249 + u64 orp_zero; /* ORP disabled */
3250 +};
3251 +
3252 +struct dpa_napi_portal {
3253 + struct napi_struct napi;
3254 + struct qman_portal *p;
3255 +};
3256 +
3257 +struct dpa_percpu_priv_s {
3258 + struct net_device *net_dev;
3259 + struct dpa_napi_portal *np;
3260 + u64 in_interrupt;
3261 + u64 tx_returned;
3262 + u64 tx_confirm;
3263 + /* fragmented (non-linear) skbuffs received from the stack */
3264 + u64 tx_frag_skbuffs;
3265 + /* number of S/G frames received */
3266 + u64 rx_sg;
3267 +
3268 + struct rtnl_link_stats64 stats;
3269 + struct dpa_rx_errors rx_errors;
3270 + struct dpa_ern_cnt ern_cnt;
3271 +};
3272 +
3273 +struct dpa_priv_s {
3274 + struct dpa_percpu_priv_s __percpu *percpu_priv;
3275 + struct dpa_bp *dpa_bp;
3276 + /* Store here the needed Tx headroom for convenience and speed
3277 + * (even though it can be computed based on the fields of buf_layout)
3278 + */
3279 + uint16_t tx_headroom;
3280 + struct net_device *net_dev;
3281 + struct mac_device *mac_dev;
3282 + struct qman_fq *egress_fqs[DPAA_ETH_TX_QUEUES];
3283 + struct qman_fq *conf_fqs[DPAA_ETH_TX_QUEUES];
3284 +
3285 + size_t bp_count;
3286 +
3287 + uint16_t channel; /* "fsl,qman-channel-id" */
3288 + struct list_head dpa_fq_list;
3289 +
3290 +#ifdef CONFIG_FSL_DPAA_DBG_LOOP
3291 + struct dentry *debugfs_loop_file;
3292 +#endif
3293 +
3294 + uint32_t msg_enable; /* net_device message level */
3295 +#ifdef CONFIG_FSL_DPAA_1588
3296 + struct dpa_ptp_tsu *tsu;
3297 +#endif
3298 +
3299 +#if defined(CONFIG_FSL_SDK_FMAN_TEST)
3300 +/* TODO: this is temporary until pcd support is implemented in dpaa */
3301 + int priv_pcd_num_ranges;
3302 + struct pcd_range priv_pcd_ranges[FMAN_PCD_TESTS_MAX_NUM_RANGES];
3303 +#endif
3304 +
3305 + struct {
3306 + /**
3307 + * All egress queues to a given net device belong to one
3308 + * (and the same) congestion group.
3309 + */
3310 + struct qman_cgr cgr;
3311 + /* If congested, when it began. Used for performance stats. */
3312 + u32 congestion_start_jiffies;
3313 + /* Number of jiffies the Tx port was congested. */
3314 + u32 congested_jiffies;
3315 + /**
3316 + * Counter for the number of times the CGR
3317 + * entered congestion state
3318 + */
3319 + u32 cgr_congested_count;
3320 + } cgr_data;
3321 + /* Use a per-port CGR for ingress traffic. */
3322 + bool use_ingress_cgr;
3323 + struct qman_cgr ingress_cgr;
3324 +
3325 +#ifdef CONFIG_FSL_DPAA_TS
3326 + bool ts_tx_en; /* Tx timestamping enabled */
3327 + bool ts_rx_en; /* Rx timestamping enabled */
3328 +#endif /* CONFIG_FSL_DPAA_TS */
3329 +
3330 + struct dpa_buffer_layout_s *buf_layout;
3331 + uint16_t rx_headroom;
3332 + char if_type[30];
3333 +
3334 + void *peer;
3335 +#ifdef CONFIG_PM
3336 + u32 wol;
3337 +#endif
3338 +#ifdef CONFIG_FSL_DPAA_DBG_LOOP
3339 + int loop_id;
3340 + int loop_to;
3341 +#endif
3342 +#ifdef CONFIG_FSL_DPAA_CEETM
3343 + bool ceetm_en; /* CEETM QoS enabled */
3344 +#endif
3345 +};
3346 +
3347 +struct fm_port_fqs {
3348 + struct dpa_fq *tx_defq;
3349 + struct dpa_fq *tx_errq;
3350 + struct dpa_fq *rx_defq;
3351 + struct dpa_fq *rx_errq;
3352 +};
3353 +
3354 +
3355 +#ifdef CONFIG_FSL_DPAA_DBG_LOOP
3356 +extern struct net_device *dpa_loop_netdevs[20];
3357 +#endif
3358 +
3359 +/* functions with different implementation for SG and non-SG: */
3360 +int dpa_bp_priv_seed(struct dpa_bp *dpa_bp);
3361 +int dpaa_eth_refill_bpools(struct dpa_bp *dpa_bp, int *count_ptr);
3362 +void __hot _dpa_rx(struct net_device *net_dev,
3363 + struct qman_portal *portal,
3364 + const struct dpa_priv_s *priv,
3365 + struct dpa_percpu_priv_s *percpu_priv,
3366 + const struct qm_fd *fd,
3367 + u32 fqid,
3368 + int *count_ptr);
3369 +int __hot dpa_tx(struct sk_buff *skb, struct net_device *net_dev);
3370 +int __hot dpa_tx_extended(struct sk_buff *skb, struct net_device *net_dev,
3371 + struct qman_fq *egress_fq, struct qman_fq *conf_fq);
3372 +struct sk_buff *_dpa_cleanup_tx_fd(const struct dpa_priv_s *priv,
3373 + const struct qm_fd *fd);
3374 +void __hot _dpa_process_parse_results(const fm_prs_result_t *parse_results,
3375 + const struct qm_fd *fd,
3376 + struct sk_buff *skb,
3377 + int *use_gro);
3378 +#ifndef CONFIG_FSL_DPAA_TS
3379 +bool dpa_skb_is_recyclable(struct sk_buff *skb);
3380 +bool dpa_buf_is_recyclable(struct sk_buff *skb,
3381 + uint32_t min_size,
3382 + uint16_t min_offset,