1 From ae15f50544e6012c998ef59f6c12e334da3c9bff Mon Sep 17 00:00:00 2001
2 From: John Crispin <blogic@openwrt.org>
3 Date: Fri, 3 Aug 2012 10:27:25 +0200
4 Subject: [PATCH 40/40] owrt: lantiq: add atm hack
7 arch/mips/include/asm/mach-lantiq/lantiq_atm.h | 196 +++++++++++++++++++++++
8 arch/mips/include/asm/mach-lantiq/lantiq_ptm.h | 203 ++++++++++++++++++++++++
9 arch/mips/lantiq/irq.c | 2 +
10 arch/mips/mm/cache.c | 2 +
11 include/uapi/linux/atm.h | 6 +
12 net/atm/common.c | 6 +
14 7 files changed, 416 insertions(+), 1 deletion(-)
15 create mode 100644 arch/mips/include/asm/mach-lantiq/lantiq_atm.h
16 create mode 100644 arch/mips/include/asm/mach-lantiq/lantiq_ptm.h
19 +++ b/arch/mips/include/asm/mach-lantiq/lantiq_atm.h
21 +/******************************************************************************
23 +** FILE NAME : ifx_atm.h
27 +** DATE : 17 Jun 2009
29 +** DESCRIPTION : Global ATM driver header file
30 +** COPYRIGHT : Copyright (c) 2006
31 +** Infineon Technologies AG
32 +** Am Campeon 1-12, 85579 Neubiberg, Germany
34 +** This program is free software; you can redistribute it and/or modify
35 +** it under the terms of the GNU General Public License as published by
36 +** the Free Software Foundation; either version 2 of the License, or
37 +** (at your option) any later version.
40 +** $Date $Author $Comment
41 +** 07 JUL 2009 Xu Liang Init Version
42 +*******************************************************************************/
50 + \defgroup IFX_ATM UEIP Project - ATM driver module
51 + \brief UEIP Project - ATM driver module, support Danube, Amazon-SE, AR9, VR9.
55 + \defgroup IFX_ATM_IOCTL IOCTL Commands
57 + \brief IOCTL Commands used by user application.
61 + \defgroup IFX_ATM_STRUCT Structures
63 + \brief Structures used by user application.
69 + \brief ATM driver header file
75 + * ####################################
77 + * ####################################
81 + \addtogroup IFX_ATM_STRUCT
90 + \struct atm_cell_ifEntry_t
91 + \brief Structure used for Cell Level MIB Counters.
93 + User application use this structure to call IOCTL command "PPE_ATM_MIB_CELL".
96 + __u32 ifHCInOctets_h; /*!< byte counter of ingress cells (upper 32 bits, total 64 bits) */
97 + __u32 ifHCInOctets_l; /*!< byte counter of ingress cells (lower 32 bits, total 64 bits) */
98 + __u32 ifHCOutOctets_h; /*!< byte counter of egress cells (upper 32 bits, total 64 bits) */
99 + __u32 ifHCOutOctets_l; /*!< byte counter of egress cells (lower 32 bits, total 64 bits) */
100 + __u32 ifInErrors; /*!< counter of error ingress cells */
101 + __u32 ifInUnknownProtos; /*!< counter of unknown ingress cells */
102 + __u32 ifOutErrors; /*!< counter of error egress cells */
103 +} atm_cell_ifEntry_t;
106 + \struct atm_aal5_ifEntry_t
107 + \brief Structure used for AAL5 Frame Level MIB Counters.
109 + User application use this structure to call IOCTL command "PPE_ATM_MIB_AAL5".
112 + __u32 ifHCInOctets_h; /*!< byte counter of ingress packets (upper 32 bits, total 64 bits) */
113 + __u32 ifHCInOctets_l; /*!< byte counter of ingress packets (lower 32 bits, total 64 bits) */
114 + __u32 ifHCOutOctets_h; /*!< byte counter of egress packets (upper 32 bits, total 64 bits) */
115 + __u32 ifHCOutOctets_l; /*!< byte counter of egress packets (lower 32 bits, total 64 bits) */
116 + __u32 ifInUcastPkts; /*!< counter of ingress packets */
117 + __u32 ifOutUcastPkts; /*!< counter of egress packets */
118 + __u32 ifInErrors; /*!< counter of error ingress packets */
119 + __u32 ifInDiscards; /*!< counter of dropped ingress packets */
120 + __u32 ifOutErros; /*!< counter of error egress packets */
121 + __u32 ifOutDiscards; /*!< counter of dropped egress packets */
122 +} atm_aal5_ifEntry_t;
125 + \struct atm_aal5_vcc_t
126 + \brief Structure used for per PVC AAL5 Frame Level MIB Counters.
128 + This structure is a part of structure "atm_aal5_vcc_x_t".
131 + __u32 aal5VccCrcErrors; /*!< counter of ingress packets with CRC error */
132 + __u32 aal5VccSarTimeOuts; /*!< counter of ingress packets with Re-assemble timeout */ //no timer support yet
133 + __u32 aal5VccOverSizedSDUs; /*!< counter of oversized ingress packets */
137 + \struct atm_aal5_vcc_x_t
138 + \brief Structure used for per PVC AAL5 Frame Level MIB Counters.
140 + User application use this structure to call IOCTL command "PPE_ATM_MIB_VCC".
143 + int vpi; /*!< VPI of the VCC to get MIB counters */
144 + int vci; /*!< VCI of the VCC to get MIB counters */
145 + atm_aal5_vcc_t mib_vcc; /*!< structure to get MIB counters */
153 + * ####################################
155 + * ####################################
159 + \addtogroup IFX_ATM_IOCTL
167 + \brief ATM IOCTL Magic Number
169 +#define PPE_ATM_IOC_MAGIC 'o'
171 + \brief ATM IOCTL Command - Get Cell Level MIB Counters
173 + This command is obsolete. User can get cell level MIB from DSL API.
174 + This command uses structure "atm_cell_ifEntry_t" as parameter for output of MIB counters.
176 +#define PPE_ATM_MIB_CELL _IOW(PPE_ATM_IOC_MAGIC, 0, atm_cell_ifEntry_t)
178 + \brief ATM IOCTL Command - Get AAL5 Level MIB Counters
180 + Get AAL5 packet counters.
181 + This command uses structure "atm_aal5_ifEntry_t" as parameter for output of MIB counters.
183 +#define PPE_ATM_MIB_AAL5 _IOW(PPE_ATM_IOC_MAGIC, 1, atm_aal5_ifEntry_t)
185 + \brief ATM IOCTL Command - Get Per PVC MIB Counters
187 + Get AAL5 packet counters for each PVC.
188 + This command uses structure "atm_aal5_vcc_x_t" as parameter for input of VPI/VCI information and output of MIB counters.
190 +#define PPE_ATM_MIB_VCC _IOWR(PPE_ATM_IOC_MAGIC, 2, atm_aal5_vcc_x_t)
192 + \brief Total Number of ATM IOCTL Commands
194 +#define PPE_ATM_IOC_MAXNR 3
201 + * ####################################
203 + * ####################################
207 +struct port_cell_info {
208 + unsigned int port_num;
209 + unsigned int tx_link_rate[2];
218 +++ b/arch/mips/include/asm/mach-lantiq/lantiq_ptm.h
220 +/******************************************************************************
222 +** FILE NAME : ifx_ptm.h
226 +** DATE : 17 Jun 2009
227 +** AUTHOR : Xu Liang
228 +** DESCRIPTION : Global PTM driver header file
229 +** COPYRIGHT : Copyright (c) 2006
230 +** Infineon Technologies AG
231 +** Am Campeon 1-12, 85579 Neubiberg, Germany
233 +** This program is free software; you can redistribute it and/or modify
234 +** it under the terms of the GNU General Public License as published by
235 +** the Free Software Foundation; either version 2 of the License, or
236 +** (at your option) any later version.
239 +** $Date $Author $Comment
240 +** 07 JUL 2009 Xu Liang Init Version
241 +*******************************************************************************/
249 + \defgroup IFX_PTM UEIP Project - PTM driver module
250 + \brief UEIP Project - PTM driver module, support Danube, Amazon-SE, AR9, VR9.
254 + \defgroup IFX_PTM_IOCTL IOCTL Commands
256 + \brief IOCTL Commands used by user application.
260 + \defgroup IFX_PTM_STRUCT Structures
262 + \brief Structures used by user application.
268 + \brief PTM driver header file
274 + * ####################################
276 + * ####################################
282 + * ####################################
284 + * ####################################
288 + \addtogroup IFX_PTM_IOCTL
296 + \brief PTM IOCTL Command - Get codeword MIB counters.
298 + This command uses structure "PTM_CW_IF_ENTRY_T" to get codeword level MIB counters.
300 +#define IFX_PTM_MIB_CW_GET SIOCDEVPRIVATE + 1
302 + \brief PTM IOCTL Command - Get packet MIB counters.
304 + This command uses structure "PTM_FRAME_MIB_T" to get packet level MIB counters.
306 +#define IFX_PTM_MIB_FRAME_GET SIOCDEVPRIVATE + 2
308 + \brief PTM IOCTL Command - Get firmware configuration (CRC).
310 + This command uses structure "IFX_PTM_CFG_T" to get firmware configuration (CRC).
312 +#define IFX_PTM_CFG_GET SIOCDEVPRIVATE + 3
314 + \brief PTM IOCTL Command - Set firmware configuration (CRC).
316 + This command uses structure "IFX_PTM_CFG_T" to set firmware configuration (CRC).
318 +#define IFX_PTM_CFG_SET SIOCDEVPRIVATE + 4
320 + \brief PTM IOCTL Command - Program priority value to TX queue mapping.
322 + This command uses structure "IFX_PTM_PRIO_Q_MAP_T" to program priority value to TX queue mapping.
324 +#define IFX_PTM_MAP_PKT_PRIO_TO_Q SIOCDEVPRIVATE + 14
330 + \addtogroup IFX_PTM_STRUCT
339 + \typedef PTM_CW_IF_ENTRY_T
340 + \brief Wrapping of structure "ptm_cw_ifEntry_t".
343 + \struct ptm_cw_ifEntry_t
344 + \brief Structure used for CodeWord level MIB counters.
346 +typedef struct ptm_cw_ifEntry_t {
347 + uint32_t ifRxNoIdleCodewords; /*!< output, number of ingress user codeword */
348 + uint32_t ifRxIdleCodewords; /*!< output, number of ingress idle codeword */
349 + uint32_t ifRxCodingViolation; /*!< output, number of error ingress codeword */
350 + uint32_t ifTxNoIdleCodewords; /*!< output, number of egress user codeword */
351 + uint32_t ifTxIdleCodewords; /*!< output, number of egress idle codeword */
352 +} PTM_CW_IF_ENTRY_T;
355 + \typedef PTM_FRAME_MIB_T
356 + \brief Wrapping of structure "ptm_frame_mib_t".
359 + \struct ptm_frame_mib_t
360 + \brief Structure used for packet level MIB counters.
362 +typedef struct ptm_frame_mib_t {
363 + uint32_t RxCorrect; /*!< output, number of ingress packet */
364 + uint32_t TC_CrcError; /*!< output, number of egress packet with CRC error */
365 + uint32_t RxDropped; /*!< output, number of dropped ingress packet */
366 + uint32_t TxSend; /*!< output, number of egress packet */
370 + \typedef IFX_PTM_CFG_T
371 + \brief Wrapping of structure "ptm_cfg_t".
375 + \brief Structure used for ETH/TC CRC configuration.
377 +typedef struct ptm_cfg_t {
378 + uint32_t RxEthCrcPresent; /*!< input/output, ingress packet has ETH CRC */
379 + uint32_t RxEthCrcCheck; /*!< input/output, check ETH CRC of ingress packet */
380 + uint32_t RxTcCrcCheck; /*!< input/output, check TC CRC of ingress codeword */
381 + uint32_t RxTcCrcLen; /*!< input/output, length of TC CRC of ingress codeword */
382 + uint32_t TxEthCrcGen; /*!< input/output, generate ETH CRC for egress packet */
383 + uint32_t TxTcCrcGen; /*!< input/output, generate TC CRC for egress codeword */
384 + uint32_t TxTcCrcLen; /*!< input/output, length of TC CRC of egress codeword */
388 + \typedef IFX_PTM_PRIO_Q_MAP_T
389 + \brief Wrapping of structure "ppe_prio_q_map".
392 + \struct ppe_prio_q_map
393 + \brief Structure used for Priority Value to TX Queue mapping.
395 +typedef struct ppe_prio_q_map {
398 + int vpi; // ignored in eth interface
399 + int vci; // ignored in eth interface
400 +} IFX_PTM_PRIO_Q_MAP_T;
407 + * ####################################
409 + * ####################################
413 +struct port_cell_info {
414 + unsigned int port_num;
415 + unsigned int tx_link_rate[2];
423 --- a/arch/mips/lantiq/irq.c
424 +++ b/arch/mips/lantiq/irq.c
426 #include <linux/of_platform.h>
427 #include <linux/of_address.h>
428 #include <linux/of_irq.h>
429 +#include <linux/module.h>
431 #include <asm/bootinfo.h>
432 #include <asm/irq_cpu.h>
433 @@ -99,6 +100,7 @@ void ltq_mask_and_ack_irq(struct irq_dat
434 ltq_icu_w32(im, ltq_icu_r32(im, ier) & ~BIT(offset), ier);
435 ltq_icu_w32(im, BIT(offset), isr);
437 +EXPORT_SYMBOL(ltq_mask_and_ack_irq);
439 static void ltq_ack_irq(struct irq_data *d)
441 --- a/arch/mips/mm/cache.c
442 +++ b/arch/mips/mm/cache.c
443 @@ -58,6 +58,8 @@ void (*_dma_cache_wback)(unsigned long s
444 void (*_dma_cache_inv)(unsigned long start, unsigned long size);
446 EXPORT_SYMBOL(_dma_cache_wback_inv);
447 +EXPORT_SYMBOL(_dma_cache_wback);
448 +EXPORT_SYMBOL(_dma_cache_inv);
450 #endif /* CONFIG_DMA_NONCOHERENT */
452 --- a/include/uapi/linux/atm.h
453 +++ b/include/uapi/linux/atm.h
456 #define ATM_ANYCLASS 5 /* compatible with everything */
458 +#define ATM_VBR_NRT ATM_VBR
459 +#define ATM_VBR_RT 6
460 +#define ATM_UBR_PLUS 7
463 #define ATM_MAX_PCR -1 /* maximum available PCR */
467 unsigned char traffic_class; /* traffic class (ATM_UBR, ...) */
468 int max_pcr; /* maximum PCR in cells per second */
469 --- a/net/atm/common.c
470 +++ b/net/atm/common.c
471 @@ -62,11 +62,17 @@ static void vcc_remove_socket(struct soc
472 write_unlock_irq(&vcc_sklist_lock);
475 +struct sk_buff* (*ifx_atm_alloc_tx)(struct atm_vcc *, unsigned int) = NULL;
476 +EXPORT_SYMBOL(ifx_atm_alloc_tx);
478 static struct sk_buff *alloc_tx(struct atm_vcc *vcc, unsigned int size)
481 struct sock *sk = sk_atm(vcc);
483 + if (ifx_atm_alloc_tx != NULL)
484 + return ifx_atm_alloc_tx(vcc, size);
486 if (sk_wmem_alloc_get(sk) && !atm_may_send(vcc, size)) {
487 pr_debug("Sorry: wmem_alloc = %d, size = %d, sndbuf = %d\n",
488 sk_wmem_alloc_get(sk), size, sk->sk_sndbuf);
491 @@ -154,7 +154,7 @@ static void *vcc_seq_next(struct seq_fil
492 static void pvc_info(struct seq_file *seq, struct atm_vcc *vcc)
494 static const char *const class_name[] = {
495 - "off", "UBR", "CBR", "VBR", "ABR"};
496 + "off","UBR","CBR","NTR-VBR","ABR","ANY","RT-VBR","UBR+","GFR"};
497 static const char *const aal_name[] = {
498 "---", "1", "2", "3/4", /* 0- 3 */
499 "???", "5", "???", "???", /* 4- 7 */