1 #include <linux/config.h>
4 #include <linux/sysctl.h>
8 /* void enableReceive(struct net_device* dev);
13 #define ARLAN_STR_SIZE 0x2ff0
14 #define DEV_ARLAN_INFO 1
16 #define SARLG(type,var) {\
17 pos += sprintf(arlan_drive_info+pos, "%s\t=\t0x%x\n", #var, READSHMB(priva->card->var)); \
20 #define SARLBN(type,var,nn) {\
21 pos += sprintf(arlan_drive_info+pos, "%s\t=\t0x",#var);\
22 for (i=0; i < nn; i++ ) pos += sprintf(arlan_drive_info+pos, "%02x",READSHMB(priva->card->var[i]));\
23 pos += sprintf(arlan_drive_info+pos, "\n"); \
26 #define SARLBNpln(type,var,nn) {\
27 for (i=0; i < nn; i++ ) pos += sprintf(arlan_drive_info+pos, "%02x",READSHMB(priva->card->var[i]));\
30 #define SARLSTR(var,nn) {\
33 if (nn > 399 ) tmpLn = 399; \
34 memcpy(tmpStr,(char *) priva->conf->var,tmpLn);\
36 pos += sprintf(arlan_drive_info+pos, "%s\t=\t%s \n",#var,priva->conf->var);\
39 #define SARLUC(var) SARLG(u_char, var)
40 #define SARLUCN(var,nn) SARLBN(u_char,var, nn)
41 #define SARLUS(var) SARLG(u_short, var)
42 #define SARLUSN(var,nn) SARLBN(u_short,var, nn)
43 #define SARLUI(var) SARLG(u_int, var)
45 #define SARLUSA(var) {\
47 memcpy(&tmpVar, (short *) priva->conf->var,2); \
48 pos += sprintf(arlan_drive_info+pos, "%s\t=\t0x%x\n",#var, tmpVar);\
51 #define SARLUIA(var) {\
53 memcpy(&tmpVar, (int* )priva->conf->var,4); \
54 pos += sprintf(arlan_drive_info+pos, "%s\t=\t0x%x\n",#var, tmpVar);\
58 static const char *arlan_diagnostic_info_string(struct net_device
*dev
)
61 struct arlan_private
*priv
= netdev_priv(dev
);
62 volatile struct arlan_shmem __iomem
*arlan
= priv
->card
;
63 u_char diagnosticInfo
;
65 READSHM(diagnosticInfo
, arlan
->diagnosticInfo
, u_char
);
67 switch (diagnosticInfo
)
70 return "Diagnostic info is OK";
72 return "ERROR EPROM Checksum error ";
74 return "ERROR Local Ram Test Failed ";
76 return "ERROR SCC failure ";
78 return "ERROR BackBone failure ";
80 return "ERROR transceiver not found ";
82 return "ERROR no more address space ";
84 return "ERROR Checksum error ";
86 return "ERROR Missing SS Code";
88 return "ERROR Invalid config format";
90 return "ERROR Reserved errorcode F5";
92 return "ERROR Invalid spreading code/channel number";
94 return "ERROR Load Code Error";
96 return "ERROR Reserver errorcode F2 ";
98 return "ERROR Invalid command receivec by LAN card ";
100 return "ERROR Invalid parameter found in command ";
102 return "ERROR On-chip timer failure ";
104 return "ERROR T410 timer failure ";
106 return "ERROR Too Many TxEnable commands ";
108 return "ERROR EEPROM error on radio module ";
110 return "ERROR unknown Diagnostic info reply code ";
114 static const char *arlan_hardware_type_string(struct net_device
*dev
)
117 struct arlan_private
*priv
= netdev_priv(dev
);
118 volatile struct arlan_shmem __iomem
*arlan
= priv
->card
;
120 READSHM(hardwareType
, arlan
->hardwareType
, u_char
);
121 switch (hardwareType
)
128 return "type TMA coproc";
130 return "type A650E ";
132 return "type TMA coproc Australian";
134 return "type A650A ";
136 return "type TMA coproc European";
140 return "type A655A ";
142 return "type A655E ";
146 return "type A670E ";
148 return "type A670A ";
152 return "type A411TA";
158 return "type A412TA";
160 return "type A411TE";
162 return "type A412TE";
164 return "type A671T ";
166 return "type A671TA ";
168 return "type A671TE ";
170 return "type A415T ";
172 return "type A415TA ";
174 return "type A415TE ";
178 return "type A672A ";
182 return "type IC2200";
187 #ifdef ARLAN_DEBUGGING
188 static void arlan_print_diagnostic_info(struct net_device
*dev
)
191 u_char diagnosticInfo
;
192 u_short diagnosticOffset
;
194 struct arlan_private
*priv
= netdev_priv(dev
);
195 volatile struct arlan_shmem __iomem
*arlan
= priv
->card
;
197 // ARLAN_DEBUG_ENTRY("arlan_print_diagnostic_info");
199 if (READSHMB(arlan
->configuredStatusFlag
) == 0)
200 printk("Arlan: Card NOT configured\n");
202 printk("Arlan: Card is configured\n");
204 READSHM(diagnosticInfo
, arlan
->diagnosticInfo
, u_char
);
205 READSHM(diagnosticOffset
, arlan
->diagnosticOffset
, u_short
);
207 printk(KERN_INFO
"%s\n", arlan_diagnostic_info_string(dev
));
209 if (diagnosticInfo
!= 0xff)
210 printk("%s arlan: Diagnostic Offset %d \n", dev
->name
, diagnosticOffset
);
212 printk("arlan: LAN CODE ID = ");
213 for (i
= 0; i
< 6; i
++)
214 DEBUGSHM(1, "%03d:", arlan
->lanCardNodeId
[i
], u_char
);
217 printk("arlan: Arlan BroadCast address = ");
218 for (i
= 0; i
< 6; i
++)
219 DEBUGSHM(1, "%03d:", arlan
->broadcastAddress
[i
], u_char
);
222 READSHM(hardwareType
, arlan
->hardwareType
, u_char
);
223 printk(KERN_INFO
"%s\n", arlan_hardware_type_string(dev
));
226 DEBUGSHM(1, "arlan: channelNumber=%d\n", arlan
->channelNumber
, u_char
);
227 DEBUGSHM(1, "arlan: channelSet=%d\n", arlan
->channelSet
, u_char
);
228 DEBUGSHM(1, "arlan: spreadingCode=%d\n", arlan
->spreadingCode
, u_char
);
229 DEBUGSHM(1, "arlan: radioNodeId=%d\n", arlan
->radioNodeId
, u_short
);
230 DEBUGSHM(1, "arlan: SID =%d\n", arlan
->SID
, u_short
);
231 DEBUGSHM(1, "arlan: rxOffset=%d\n", arlan
->rxOffset
, u_short
);
233 DEBUGSHM(1, "arlan: registration mode is %d\n", arlan
->registrationMode
, u_char
);
235 printk("arlan: name= ");
238 for (i
= 0; i
< 16; i
++)
241 READSHM(c
, arlan
->name
[i
], char);
247 // ARLAN_DEBUG_EXIT("arlan_print_diagnostic_info");
252 /****************************** TEST MEMORY **************/
254 static int arlan_hw_test_memory(struct net_device
*dev
)
258 int memlen
= sizeof(struct arlan_shmem
) - 0xF; /* avoid control register */
259 volatile char *arlan_mem
= (char *) (dev
->mem_start
);
260 struct arlan_private
*priv
= netdev_priv(dev
);
261 volatile struct arlan_shmem __iomem
*arlan
= priv
->card
;
266 /* hold card in reset state */
267 setHardwareReset(dev
);
271 for (i
= 0; i
< memlen
; i
++)
272 WRITESHM(arlan_mem
[i
], ((u_char
) pattern
++), u_char
);
275 for (i
= 0; i
< memlen
; i
++)
278 READSHM(res
, arlan_mem
[i
], char);
279 if (res
!= pattern
++)
281 printk(KERN_ERR
"Arlan driver memory test 1 failed \n");
287 for (i
= 0; i
< memlen
; i
++)
288 WRITESHM(arlan_mem
[i
], ~(pattern
++), char);
291 for (i
= 0; i
< memlen
; i
++)
294 READSHM(res
, arlan_mem
[i
], char);
295 if (res
!= ~(pattern
++))
297 printk(KERN_ERR
"Arlan driver memory test 2 failed \n");
303 for (i
= 0; i
< memlen
; i
++)
304 WRITESHM(arlan_mem
[i
], 0x00, char);
306 IFDEBUG(1) printk(KERN_INFO
"Arlan: memory tests ok\n");
308 /* set reset flag and then release reset */
309 WRITESHM(arlan
->resetFlag
, 0xff, u_char
);
311 clearChannelAttention(dev
);
312 clearHardwareReset(dev
);
314 /* wait for reset flag to become zero, we'll wait for two seconds */
315 if (arlan_command(dev
, ARLAN_COMMAND_LONG_WAIT_NOW
))
317 printk(KERN_ERR
"%s arlan: failed to come back from memory test\n", dev
->name
);
323 static int arlan_setup_card_by_book(struct net_device
*dev
)
325 u_char irqLevel
, configuredStatusFlag
;
326 struct arlan_private
*priv
= netdev_priv(dev
);
327 volatile struct arlan_shmem __iomem
*arlan
= priv
->card
;
329 // ARLAN_DEBUG_ENTRY("arlan_setup_card");
331 READSHM(configuredStatusFlag
, arlan
->configuredStatusFlag
, u_char
);
334 if (configuredStatusFlag
!= 0)
335 IFDEBUG(10) printk("arlan: CARD IS CONFIGURED\n");
337 IFDEBUG(10) printk("arlan: card is NOT configured\n");
339 if (testMemory
|| (READSHMB(arlan
->diagnosticInfo
) != 0xff))
340 if (arlan_hw_test_memory(dev
))
343 DEBUGSHM(4, "arlan configuredStatus = %d \n", arlan
->configuredStatusFlag
, u_char
);
344 DEBUGSHM(4, "arlan driver diagnostic: 0x%2x\n", arlan
->diagnosticInfo
, u_char
);
346 /* issue nop command - no interrupt */
347 arlan_command(dev
, ARLAN_COMMAND_NOOP
);
348 if (arlan_command(dev
, ARLAN_COMMAND_WAIT_NOW
) != 0)
351 IFDEBUG(50) printk("1st Noop successfully executed !!\n");
353 /* try to turn on the arlan interrupts */
354 clearClearInterrupt(dev
);
355 setClearInterrupt(dev
);
356 setInterruptEnable(dev
);
358 /* issue nop command - with interrupt */
360 arlan_command(dev
, ARLAN_COMMAND_NOOPINT
);
361 if (arlan_command(dev
, ARLAN_COMMAND_WAIT_NOW
) != 0)
365 IFDEBUG(50) printk("2nd Noop successfully executed !!\n");
367 READSHM(irqLevel
, arlan
->irqLevel
, u_char
)
369 if (irqLevel
!= dev
->irq
)
371 IFDEBUG(1) printk(KERN_WARNING
"arlan dip switches set irq to %d\n", irqLevel
);
372 printk(KERN_WARNING
"device driver irq set to %d - does not match\n", dev
->irq
);
376 IFDEBUG(2) printk("irq level is OK\n");
379 IFDEBUG(3) arlan_print_diagnostic_info(dev
);
381 arlan_command(dev
, ARLAN_COMMAND_CONF
);
383 READSHM(configuredStatusFlag
, arlan
->configuredStatusFlag
, u_char
);
384 if (configuredStatusFlag
== 0)
386 printk(KERN_WARNING
"arlan configure failed\n");
389 arlan_command(dev
, ARLAN_COMMAND_LONG_WAIT_NOW
);
390 arlan_command(dev
, ARLAN_COMMAND_RX
);
391 arlan_command(dev
, ARLAN_COMMAND_LONG_WAIT_NOW
);
392 printk(KERN_NOTICE
"%s: arlan driver version %s loaded\n",
393 dev
->name
, arlan_version
);
395 // ARLAN_DEBUG_EXIT("arlan_setup_card");
397 return 0; /* no errors */
401 #ifdef ARLAN_PROC_INTERFACE
402 #ifdef ARLAN_PROC_SHM_DUMP
404 static char arlan_drive_info
[ARLAN_STR_SIZE
] = "A655\n\0";
406 static int arlan_sysctl_info(ctl_table
* ctl
, int write
, struct file
*filp
,
407 void __user
*buffer
, size_t * lenp
, loff_t
*ppos
)
410 int retv
, pos
, devnum
;
411 struct arlan_private
*priva
= NULL
;
412 struct net_device
*dev
;
417 for (i
= 0; i
< 100; i
++)
418 printk("adi %x \n", arlan_drive_info
[i
]);
420 if (ctl
->procname
== NULL
|| arlan_drive_info
== NULL
)
422 printk(KERN_WARNING
" procname is NULL in sysctl_table or arlan_drive_info is NULL \n at arlan module\n ");
425 devnum
= ctl
->procname
[5] - '0';
426 if (devnum
< 0 || devnum
> MAX_ARLANS
- 1)
428 printk(KERN_WARNING
"too strange devnum in procfs parse\n ");
431 else if (arlan_device
[devnum
] == NULL
)
434 pos
+= sprintf(arlan_drive_info
+ pos
, "\t%s\n\n", ctl
->procname
);
435 pos
+= sprintf(arlan_drive_info
+ pos
, "No device found here \n");
439 priva
= arlan_device
[devnum
]->priv
;
443 printk(KERN_WARNING
" Could not find the device private in arlan procsys, bad\n ");
446 dev
= arlan_device
[devnum
];
448 memcpy_fromio(priva
->conf
, priva
->card
, sizeof(struct arlan_shmem
));
450 pos
= sprintf(arlan_drive_info
, "Arlan info \n");
451 /* Header Signature */
452 SARLSTR(textRegion
, 48);
454 pos
+= sprintf(arlan_drive_info
+ pos
, "diagnosticInfo\t=\t%s \n", arlan_diagnostic_info_string(dev
));
455 SARLUC(diagnosticInfo
);
456 SARLUS(diagnosticOffset
);
458 SARLUCN(lanCardNodeId
, 6);
459 SARLUCN(broadcastAddress
, 6);
460 pos
+= sprintf(arlan_drive_info
+ pos
, "hardwareType =\t %s \n", arlan_hardware_type_string(dev
));
461 SARLUC(hardwareType
);
462 SARLUC(majorHardwareVersion
);
463 SARLUC(minorHardwareVersion
);
465 SARLUC(defaultChannelSet
);
468 /* Control/Status Block - 0x0080 */
469 SARLUC(interruptInProgress
);
470 SARLUC(cntrlRegImage
);
474 SARLUCN(commandParameter
, 15);
476 /* Receive Status - 0x00a0 */
482 SARLUC(rxBroadcastFlag
);
487 /* Transmit Status - 0x00b0 */
489 SARLUC(txAckQuality
);
492 SARLUCN(registeredRouter
, 6);
493 SARLUCN(backboneRouter
, 6);
494 SARLUC(registrationStatus
);
495 SARLUC(configuredStatusFlag
);
497 SARLUCN(ultimateDestAddress
, 6);
498 SARLUCN(immedDestAddress
, 6);
499 SARLUCN(immedSrcAddress
, 6);
500 SARLUS(rxSequenceNumber
);
501 SARLUC(assignedLocaltalkAddress
);
504 /* System Parameter Block */
506 /* - Driver Parameters (Novell Specific) */
509 SARLUS(transportTime
);
512 /* - Configuration Parameters */
514 SARLUC(spreadingCode
);
516 SARLUC(channelNumber
);
519 SARLUC(scramblingDisable
);
523 SARLUC(txAttenuation
);
525 SARLUS(globalChecksum
);
527 SARLUS(maxDatagramSize
);
528 SARLUS(maxFrameSize
);
532 SARLUC(rootOrRepeater
);
533 SARLUCN(specifiedRouter
, 6);
534 SARLUS(fastPollPeriod
);
536 SARLUSA(fastPollDelay
);
537 SARLUC(arlThreshold
);
540 SARLUS(specRouterTimeout
);
545 SARLUCN(encryptionKey
, 12);
551 SARLUS(sectionChecksum
);
553 SARLUC(registrationMode
);
554 SARLUC(registrationFill
);
556 SARLUS(refreshPeriod
);
559 SARLUC(localTalkAddress
);
568 /* SARLUCN( _16, 0x140);
570 /* Statistics Block - 0x0300 */
573 SARLUCN(resetTime
, 18);
574 SARLUIA(numDatagramsTransmitted
);
575 SARLUIA(numReTransmissions
);
576 SARLUIA(numFramesDiscarded
);
577 SARLUIA(numDatagramsReceived
);
578 SARLUIA(numDuplicateReceivedFrames
);
579 SARLUIA(numDatagramsDiscarded
);
580 SARLUS(maxNumReTransmitDatagram
);
581 SARLUS(maxNumReTransmitFrames
);
582 SARLUS(maxNumConsecutiveDuplicateFrames
);
583 /* misaligned here so we have to go to characters */
584 SARLUIA(numBytesTransmitted
);
585 SARLUIA(numBytesReceived
);
586 SARLUIA(numCRCErrors
);
587 SARLUIA(numLengthErrors
);
588 SARLUIA(numAbortErrors
);
589 SARLUIA(numTXUnderruns
);
590 SARLUIA(numRXOverruns
);
591 SARLUIA(numHoldOffs
);
592 SARLUIA(numFramesTransmitted
);
593 SARLUIA(numFramesReceived
);
594 SARLUIA(numReceiveFramesLost
);
595 SARLUIA(numRXBufferOverflows
);
596 SARLUIA(numFramesDiscardedAddrMismatch
);
597 SARLUIA(numFramesDiscardedSIDMismatch
);
598 SARLUIA(numPollsTransmistted
);
599 SARLUIA(numPollAcknowledges
);
600 SARLUIA(numStatusTimeouts
);
601 SARLUIA(numNACKReceived
);
607 /* next 4 seems too long for procfs, over single page ?
609 SARLUCN( txBuffer, 0x800);
610 SARLUCN( rxBuffer, 0x800);
611 SARLUCN( _18, 0x0bff);
614 pos
+= sprintf(arlan_drive_info
+ pos
, "rxRing\t=\t0x");
615 for (i
= 0; i
< 0x50; i
++)
616 pos
+= sprintf(arlan_drive_info
+ pos
, "%02x", ((char *) priva
->conf
)[priva
->conf
->rxOffset
+ i
]);
617 pos
+= sprintf(arlan_drive_info
+ pos
, "\n");
619 SARLUC(configStatus
);
623 SARLUC(controlRegister
);
625 pos
+= sprintf(arlan_drive_info
+ pos
, " total %d chars\n", pos
);
628 pos
+= sprintf(arlan_drive_info
+ pos
, " driver name : %s\n", ctl
->procname
);
633 retv
= proc_dostring(ctl
, write
, filp
, buffer
, lenp
, ppos
);
643 static int arlan_sysctl_info161719(ctl_table
* ctl
, int write
, struct file
*filp
,
644 void __user
*buffer
, size_t * lenp
, loff_t
*ppos
)
647 int retv
, pos
, devnum
;
648 struct arlan_private
*priva
= NULL
;
651 devnum
= ctl
->procname
[5] - '0';
652 if (arlan_device
[devnum
] == NULL
)
654 pos
+= sprintf(arlan_drive_info
+ pos
, "No device found here \n");
658 priva
= arlan_device
[devnum
]->priv
;
661 printk(KERN_WARNING
" Could not find the device private in arlan procsys, bad\n ");
664 memcpy_fromio(priva
->conf
, priva
->card
, sizeof(struct arlan_shmem
));
673 retv
= proc_dostring(ctl
, write
, filp
, buffer
, lenp
, ppos
);
677 static int arlan_sysctl_infotxRing(ctl_table
* ctl
, int write
, struct file
*filp
,
678 void __user
*buffer
, size_t * lenp
, loff_t
*ppos
)
681 int retv
, pos
, devnum
;
682 struct arlan_private
*priva
= NULL
;
685 devnum
= ctl
->procname
[5] - '0';
686 if (arlan_device
[devnum
] == NULL
)
688 pos
+= sprintf(arlan_drive_info
+ pos
, "No device found here \n");
692 priva
= arlan_device
[devnum
]->priv
;
695 printk(KERN_WARNING
" Could not find the device private in arlan procsys, bad\n ");
698 memcpy_fromio(priva
->conf
, priva
->card
, sizeof(struct arlan_shmem
));
699 SARLBNpln(u_char
, txBuffer
, 0x800);
702 retv
= proc_dostring(ctl
, write
, filp
, buffer
, lenp
, ppos
);
706 static int arlan_sysctl_inforxRing(ctl_table
* ctl
, int write
, struct file
*filp
,
707 void __user
*buffer
, size_t * lenp
, loff_t
*ppos
)
710 int retv
, pos
, devnum
;
711 struct arlan_private
*priva
= NULL
;
714 devnum
= ctl
->procname
[5] - '0';
715 if (arlan_device
[devnum
] == NULL
)
717 pos
+= sprintf(arlan_drive_info
+ pos
, "No device found here \n");
720 priva
= arlan_device
[devnum
]->priv
;
723 printk(KERN_WARNING
" Could not find the device private in arlan procsys, bad\n ");
726 memcpy_fromio(priva
->conf
, priva
->card
, sizeof(struct arlan_shmem
));
727 SARLBNpln(u_char
, rxBuffer
, 0x800);
730 retv
= proc_dostring(ctl
, write
, filp
, buffer
, lenp
, ppos
);
734 static int arlan_sysctl_info18(ctl_table
* ctl
, int write
, struct file
*filp
,
735 void __user
*buffer
, size_t * lenp
, loff_t
*ppos
)
738 int retv
, pos
, devnum
;
739 struct arlan_private
*priva
= NULL
;
742 devnum
= ctl
->procname
[5] - '0';
743 if (arlan_device
[devnum
] == NULL
)
745 pos
+= sprintf(arlan_drive_info
+ pos
, "No device found here \n");
749 priva
= arlan_device
[devnum
]->priv
;
752 printk(KERN_WARNING
" Could not find the device private in arlan procsys, bad\n ");
755 memcpy_fromio(priva
->conf
, priva
->card
, sizeof(struct arlan_shmem
));
756 SARLBNpln(u_char
, _18
, 0x800);
760 retv
= proc_dostring(ctl
, write
, filp
, buffer
, lenp
, ppos
);
765 #endif /* #ifdef ARLAN_PROC_SHM_DUMP */
768 static char conf_reset_result
[200];
770 static int arlan_configure(ctl_table
* ctl
, int write
, struct file
*filp
,
771 void __user
*buffer
, size_t * lenp
, loff_t
*ppos
)
774 int devnum
= ctl
->procname
[6] - '0';
775 struct arlan_private
*priv
;
777 if (devnum
< 0 || devnum
> MAX_ARLANS
- 1)
779 printk(KERN_WARNING
"too strange devnum in procfs parse\n ");
782 else if (arlan_device
[devnum
] != NULL
)
784 priv
= arlan_device
[devnum
]->priv
;
786 arlan_command(arlan_device
[devnum
], ARLAN_COMMAND_CLEAN_AND_CONF
);
792 return proc_dostring(ctl
, write
, filp
, buffer
, lenp
, ppos
);
795 static int arlan_sysctl_reset(ctl_table
* ctl
, int write
, struct file
*filp
,
796 void __user
*buffer
, size_t * lenp
, loff_t
*ppos
)
799 int devnum
= ctl
->procname
[5] - '0';
800 struct arlan_private
*priv
;
802 if (devnum
< 0 || devnum
> MAX_ARLANS
- 1)
804 printk(KERN_WARNING
"too strange devnum in procfs parse\n ");
807 else if (arlan_device
[devnum
] != NULL
)
809 priv
= arlan_device
[devnum
]->priv
;
810 arlan_command(arlan_device
[devnum
], ARLAN_COMMAND_CLEAN_AND_RESET
);
815 return proc_dostring(ctl
, write
, filp
, buffer
, lenp
, ppos
);
819 /* Place files in /proc/sys/dev/arlan */
820 #define CTBLN(num,card,nam) \
823 .data = &(arlan_conf[card].nam),\
824 .maxlen = sizeof(int), .mode = 0600, .proc_handler = &proc_dointvec}
825 #ifdef ARLAN_DEBUGGING
827 #define ARLAN_PROC_DEBUG_ENTRIES \
828 { .ctl_name = 48, .procname = "entry_exit_debug",\
829 .data = &arlan_entry_and_exit_debug,\
830 .maxlen = sizeof(int), .mode = 0600, .proc_handler = &proc_dointvec},\
831 { .ctl_name = 49, .procname = "debug", .data = &arlan_debug,\
832 .maxlen = sizeof(int), .mode = 0600, .proc_handler = &proc_dointvec},
834 #define ARLAN_PROC_DEBUG_ENTRIES
837 #define ARLAN_SYSCTL_TABLE_TOTAL(cardNo)\
838 CTBLN(1,cardNo,spreadingCode),\
839 CTBLN(2,cardNo, channelNumber),\
840 CTBLN(3,cardNo, scramblingDisable),\
841 CTBLN(4,cardNo, txAttenuation),\
842 CTBLN(5,cardNo, systemId), \
843 CTBLN(6,cardNo, maxDatagramSize),\
844 CTBLN(7,cardNo, maxFrameSize),\
845 CTBLN(8,cardNo, maxRetries),\
846 CTBLN(9,cardNo, receiveMode),\
847 CTBLN(10,cardNo, priority),\
848 CTBLN(11,cardNo, rootOrRepeater),\
849 CTBLN(12,cardNo, SID),\
850 CTBLN(13,cardNo, registrationMode),\
851 CTBLN(14,cardNo, registrationFill),\
852 CTBLN(15,cardNo, localTalkAddress),\
853 CTBLN(16,cardNo, codeFormat),\
854 CTBLN(17,cardNo, numChannels),\
855 CTBLN(18,cardNo, channel1),\
856 CTBLN(19,cardNo, channel2),\
857 CTBLN(20,cardNo, channel3),\
858 CTBLN(21,cardNo, channel4),\
859 CTBLN(22,cardNo, txClear),\
860 CTBLN(23,cardNo, txRetries),\
861 CTBLN(24,cardNo, txRouting),\
862 CTBLN(25,cardNo, txScrambled),\
863 CTBLN(26,cardNo, rxParameter),\
864 CTBLN(27,cardNo, txTimeoutMs),\
865 CTBLN(28,cardNo, waitCardTimeout),\
866 CTBLN(29,cardNo, channelSet), \
867 {.ctl_name = 30, .procname = "name",\
868 .data = arlan_conf[cardNo].siteName,\
869 .maxlen = 16, .mode = 0600, .proc_handler = &proc_dostring},\
870 CTBLN(31,cardNo,waitTime),\
871 CTBLN(32,cardNo,lParameter),\
872 CTBLN(33,cardNo,_15),\
873 CTBLN(34,cardNo,headerSize),\
874 CTBLN(36,cardNo,tx_delay_ms),\
875 CTBLN(37,cardNo,retries),\
876 CTBLN(38,cardNo,ReTransmitPacketMaxSize),\
877 CTBLN(39,cardNo,waitReTransmitPacketMaxSize),\
878 CTBLN(40,cardNo,fastReTransCount),\
879 CTBLN(41,cardNo,driverRetransmissions),\
880 CTBLN(42,cardNo,txAckTimeoutMs),\
881 CTBLN(43,cardNo,registrationInterrupts),\
882 CTBLN(44,cardNo,hardwareType),\
883 CTBLN(45,cardNo,radioType),\
884 CTBLN(46,cardNo,writeEEPROM),\
885 CTBLN(47,cardNo,writeRadioType),\
886 ARLAN_PROC_DEBUG_ENTRIES\
887 CTBLN(50,cardNo,in_speed),\
888 CTBLN(51,cardNo,out_speed),\
889 CTBLN(52,cardNo,in_speed10),\
890 CTBLN(53,cardNo,out_speed10),\
891 CTBLN(54,cardNo,in_speed_max),\
892 CTBLN(55,cardNo,out_speed_max),\
893 CTBLN(56,cardNo,measure_rate),\
894 CTBLN(57,cardNo,pre_Command_Wait),\
895 CTBLN(58,cardNo,rx_tweak1),\
896 CTBLN(59,cardNo,rx_tweak2),\
897 CTBLN(60,cardNo,tx_queue_len),\
901 static ctl_table arlan_conf_table0[] =
903 ARLAN_SYSCTL_TABLE_TOTAL(0)
905 #ifdef ARLAN_PROC_SHM_DUMP
908 .procname
= "arlan0-txRing",
909 .data
= &arlan_drive_info
,
910 .maxlen
= ARLAN_STR_SIZE
,
912 .proc_handler
= &arlan_sysctl_infotxRing
,
916 .procname
= "arlan0-rxRing",
917 .data
= &arlan_drive_info
,
918 .maxlen
= ARLAN_STR_SIZE
,
920 .proc_handler
= &arlan_sysctl_inforxRing
,
924 .procname
= "arlan0-18",
925 .data
= &arlan_drive_info
,
926 .maxlen
= ARLAN_STR_SIZE
,
928 .proc_handler
= &arlan_sysctl_info18
,
932 .procname
= "arlan0-ring",
933 .data
= &arlan_drive_info
,
934 .maxlen
= ARLAN_STR_SIZE
,
936 .proc_handler
= &arlan_sysctl_info161719
,
940 .procname
= "arlan0-shm-cpy",
941 .data
= &arlan_drive_info
,
942 .maxlen
= ARLAN_STR_SIZE
,
944 .proc_handler
= &arlan_sysctl_info
,
949 .procname
= "config0",
950 .data
= &conf_reset_result
,
953 .proc_handler
= &arlan_configure
957 .procname
= "reset0",
958 .data
= &conf_reset_result
,
961 .proc_handler
= &arlan_sysctl_reset
,
966 static ctl_table arlan_conf_table1
[] =
969 ARLAN_SYSCTL_TABLE_TOTAL(1)
971 #ifdef ARLAN_PROC_SHM_DUMP
974 .procname
= "arlan1-txRing",
975 .data
= &arlan_drive_info
,
976 .maxlen
= ARLAN_STR_SIZE
,
978 .proc_handler
= &arlan_sysctl_infotxRing
,
982 .procname
= "arlan1-rxRing",
983 .data
= &arlan_drive_info
,
984 .maxlen
= ARLAN_STR_SIZE
,
986 .proc_handler
= &arlan_sysctl_inforxRing
,
990 .procname
= "arlan1-18",
991 .data
= &arlan_drive_info
,
992 .maxlen
= ARLAN_STR_SIZE
,
994 .proc_handler
= &arlan_sysctl_info18
,
998 .procname
= "arlan1-ring",
999 .data
= &arlan_drive_info
,
1000 .maxlen
= ARLAN_STR_SIZE
,
1002 .proc_handler
= &arlan_sysctl_info161719
,
1006 .procname
= "arlan1-shm-cpy",
1007 .data
= &arlan_drive_info
,
1008 .maxlen
= ARLAN_STR_SIZE
,
1010 .proc_handler
= &arlan_sysctl_info
,
1015 .procname
= "config1",
1016 .data
= &conf_reset_result
,
1019 .proc_handler
= &arlan_configure
,
1023 .procname
= "reset1",
1024 .data
= &conf_reset_result
,
1027 .proc_handler
= &arlan_sysctl_reset
,
1032 static ctl_table arlan_conf_table2
[] =
1035 ARLAN_SYSCTL_TABLE_TOTAL(2)
1037 #ifdef ARLAN_PROC_SHM_DUMP
1040 .procname
= "arlan2-txRing",
1041 .data
= &arlan_drive_info
,
1042 .maxlen
= ARLAN_STR_SIZE
,
1044 .proc_handler
= &arlan_sysctl_infotxRing
,
1048 .procname
= "arlan2-rxRing",
1049 .data
= &arlan_drive_info
,
1050 .maxlen
= ARLAN_STR_SIZE
,
1052 .proc_handler
= &arlan_sysctl_inforxRing
,
1056 .procname
= "arlan2-18",
1057 .data
= &arlan_drive_info
,
1058 .maxlen
= ARLAN_STR_SIZE
,
1060 .proc_handler
= &arlan_sysctl_info18
,
1064 .procname
= "arlan2-ring",
1065 .data
= &arlan_drive_info
,
1066 .maxlen
= ARLAN_STR_SIZE
,
1068 .proc_handler
= &arlan_sysctl_info161719
,
1072 .procname
= "arlan2-shm-cpy",
1073 .data
= &arlan_drive_info
,
1074 .maxlen
= ARLAN_STR_SIZE
,
1076 .proc_handler
= &arlan_sysctl_info
,
1081 .procname
= "config2",
1082 .data
= &conf_reset_result
,
1085 .proc_handler
= &arlan_configure
,
1089 .procname
= "reset2",
1090 .data
= &conf_reset_result
,
1093 .proc_handler
= &arlan_sysctl_reset
,
1098 static ctl_table arlan_conf_table3
[] =
1101 ARLAN_SYSCTL_TABLE_TOTAL(3)
1103 #ifdef ARLAN_PROC_SHM_DUMP
1106 .procname
= "arlan3-txRing",
1107 .data
= &arlan_drive_info
,
1108 .maxlen
= ARLAN_STR_SIZE
,
1110 .proc_handler
= &arlan_sysctl_infotxRing
,
1114 .procname
= "arlan3-rxRing",
1115 .data
= &arlan_drive_info
,
1116 .maxlen
= ARLAN_STR_SIZE
,
1118 .proc_handler
= &arlan_sysctl_inforxRing
,
1122 .procname
= "arlan3-18",
1123 .data
= &arlan_drive_info
,
1124 .maxlen
= ARLAN_STR_SIZE
,
1126 .proc_handler
= &arlan_sysctl_info18
,
1130 .procname
= "arlan3-ring",
1131 .data
= &arlan_drive_info
,
1132 .maxlen
= ARLAN_STR_SIZE
,
1134 .proc_handler
= &arlan_sysctl_info161719
,
1138 .procname
= "arlan3-shm-cpy",
1139 .data
= &arlan_drive_info
,
1140 .maxlen
= ARLAN_STR_SIZE
,
1142 .proc_handler
= &arlan_sysctl_info
,
1147 .procname
= "config3",
1148 .data
= &conf_reset_result
,
1151 .proc_handler
= &arlan_configure
,
1155 .procname
= "reset3",
1156 .data
= &conf_reset_result
,
1159 .proc_handler
= &arlan_sysctl_reset
,
1166 static ctl_table arlan_table
[] =
1170 .procname
= "arlan0",
1173 .child
= arlan_conf_table0
,
1177 .procname
= "arlan1",
1180 .child
= arlan_conf_table1
,
1184 .procname
= "arlan2",
1187 .child
= arlan_conf_table2
,
1191 .procname
= "arlan3",
1194 .child
= arlan_conf_table3
,
1201 static ctl_table arlan_table
[MAX_ARLANS
+ 1] =
1208 static ctl_table arlan_table
[MAX_ARLANS
+ 1] =
1215 // static int mmtu = 1234;
1217 static ctl_table arlan_root_table
[] =
1221 .procname
= "arlan",
1224 .child
= arlan_table
,
1229 /* Make sure that /proc/sys/dev is there */
1230 //static ctl_table arlan_device_root_table[] =
1232 // {CTL_DEV, "dev", NULL, 0, 0555, arlan_root_table},
1237 #ifdef CONFIG_PROC_FS
1238 static struct ctl_table_header
*arlan_device_sysctl_header
;
1240 int __init
init_arlan_proc(void)
1244 if (arlan_device_sysctl_header
)
1246 for (i
= 0; i
< MAX_ARLANS
&& arlan_device
[i
]; i
++)
1247 arlan_table
[i
].ctl_name
= i
+ 1;
1248 arlan_device_sysctl_header
= register_sysctl_table(arlan_root_table
, 0);
1249 if (!arlan_device_sysctl_header
)
1256 void __exit
cleanup_arlan_proc(void)
1258 unregister_sysctl_table(arlan_device_sysctl_header
);
1259 arlan_device_sysctl_header
= NULL
;