3 #include <linux/sysctl.h>
7 /* void enableReceive(struct net_device* dev);
12 #define ARLAN_STR_SIZE 0x2ff0
13 #define DEV_ARLAN_INFO 1
15 #define SARLG(type,var) {\
16 pos += sprintf(arlan_drive_info+pos, "%s\t=\t0x%x\n", #var, READSHMB(priva->card->var)); \
19 #define SARLBN(type,var,nn) {\
20 pos += sprintf(arlan_drive_info+pos, "%s\t=\t0x",#var);\
21 for (i=0; i < nn; i++ ) pos += sprintf(arlan_drive_info+pos, "%02x",READSHMB(priva->card->var[i]));\
22 pos += sprintf(arlan_drive_info+pos, "\n"); \
25 #define SARLBNpln(type,var,nn) {\
26 for (i=0; i < nn; i++ ) pos += sprintf(arlan_drive_info+pos, "%02x",READSHMB(priva->card->var[i]));\
29 #define SARLSTR(var,nn) {\
32 if (nn > 399 ) tmpLn = 399; \
33 memcpy(tmpStr,(char *) priva->conf->var,tmpLn);\
35 pos += sprintf(arlan_drive_info+pos, "%s\t=\t%s \n",#var,priva->conf->var);\
38 #define SARLUC(var) SARLG(u_char, var)
39 #define SARLUCN(var,nn) SARLBN(u_char,var, nn)
40 #define SARLUS(var) SARLG(u_short, var)
41 #define SARLUSN(var,nn) SARLBN(u_short,var, nn)
42 #define SARLUI(var) SARLG(u_int, var)
44 #define SARLUSA(var) {\
46 memcpy(&tmpVar, (short *) priva->conf->var,2); \
47 pos += sprintf(arlan_drive_info+pos, "%s\t=\t0x%x\n",#var, tmpVar);\
50 #define SARLUIA(var) {\
52 memcpy(&tmpVar, (int* )priva->conf->var,4); \
53 pos += sprintf(arlan_drive_info+pos, "%s\t=\t0x%x\n",#var, tmpVar);\
57 static const char *arlan_diagnostic_info_string(struct net_device
*dev
)
60 struct arlan_private
*priv
= netdev_priv(dev
);
61 volatile struct arlan_shmem __iomem
*arlan
= priv
->card
;
62 u_char diagnosticInfo
;
64 READSHM(diagnosticInfo
, arlan
->diagnosticInfo
, u_char
);
66 switch (diagnosticInfo
)
69 return "Diagnostic info is OK";
71 return "ERROR EPROM Checksum error ";
73 return "ERROR Local Ram Test Failed ";
75 return "ERROR SCC failure ";
77 return "ERROR BackBone failure ";
79 return "ERROR transceiver not found ";
81 return "ERROR no more address space ";
83 return "ERROR Checksum error ";
85 return "ERROR Missing SS Code";
87 return "ERROR Invalid config format";
89 return "ERROR Reserved errorcode F5";
91 return "ERROR Invalid spreading code/channel number";
93 return "ERROR Load Code Error";
95 return "ERROR Reserver errorcode F2 ";
97 return "ERROR Invalid command receivec by LAN card ";
99 return "ERROR Invalid parameter found in command ";
101 return "ERROR On-chip timer failure ";
103 return "ERROR T410 timer failure ";
105 return "ERROR Too Many TxEnable commands ";
107 return "ERROR EEPROM error on radio module ";
109 return "ERROR unknown Diagnostic info reply code ";
113 static const char *arlan_hardware_type_string(struct net_device
*dev
)
116 struct arlan_private
*priv
= netdev_priv(dev
);
117 volatile struct arlan_shmem __iomem
*arlan
= priv
->card
;
119 READSHM(hardwareType
, arlan
->hardwareType
, u_char
);
120 switch (hardwareType
)
127 return "type TMA coproc";
129 return "type A650E ";
131 return "type TMA coproc Australian";
133 return "type A650A ";
135 return "type TMA coproc European";
139 return "type A655A ";
141 return "type A655E ";
145 return "type A670E ";
147 return "type A670A ";
151 return "type A411TA";
157 return "type A412TA";
159 return "type A411TE";
161 return "type A412TE";
163 return "type A671T ";
165 return "type A671TA ";
167 return "type A671TE ";
169 return "type A415T ";
171 return "type A415TA ";
173 return "type A415TE ";
177 return "type A672A ";
181 return "type IC2200";
186 #ifdef ARLAN_DEBUGGING
187 static void arlan_print_diagnostic_info(struct net_device
*dev
)
190 u_char diagnosticInfo
;
191 u_short diagnosticOffset
;
193 struct arlan_private
*priv
= netdev_priv(dev
);
194 volatile struct arlan_shmem __iomem
*arlan
= priv
->card
;
196 // ARLAN_DEBUG_ENTRY("arlan_print_diagnostic_info");
198 if (READSHMB(arlan
->configuredStatusFlag
) == 0)
199 printk("Arlan: Card NOT configured\n");
201 printk("Arlan: Card is configured\n");
203 READSHM(diagnosticInfo
, arlan
->diagnosticInfo
, u_char
);
204 READSHM(diagnosticOffset
, arlan
->diagnosticOffset
, u_short
);
206 printk(KERN_INFO
"%s\n", arlan_diagnostic_info_string(dev
));
208 if (diagnosticInfo
!= 0xff)
209 printk("%s arlan: Diagnostic Offset %d \n", dev
->name
, diagnosticOffset
);
211 printk("arlan: LAN CODE ID = ");
212 for (i
= 0; i
< 6; i
++)
213 DEBUGSHM(1, "%03d:", arlan
->lanCardNodeId
[i
], u_char
);
216 printk("arlan: Arlan BroadCast address = ");
217 for (i
= 0; i
< 6; i
++)
218 DEBUGSHM(1, "%03d:", arlan
->broadcastAddress
[i
], u_char
);
221 READSHM(hardwareType
, arlan
->hardwareType
, u_char
);
222 printk(KERN_INFO
"%s\n", arlan_hardware_type_string(dev
));
225 DEBUGSHM(1, "arlan: channelNumber=%d\n", arlan
->channelNumber
, u_char
);
226 DEBUGSHM(1, "arlan: channelSet=%d\n", arlan
->channelSet
, u_char
);
227 DEBUGSHM(1, "arlan: spreadingCode=%d\n", arlan
->spreadingCode
, u_char
);
228 DEBUGSHM(1, "arlan: radioNodeId=%d\n", arlan
->radioNodeId
, u_short
);
229 DEBUGSHM(1, "arlan: SID =%d\n", arlan
->SID
, u_short
);
230 DEBUGSHM(1, "arlan: rxOffset=%d\n", arlan
->rxOffset
, u_short
);
232 DEBUGSHM(1, "arlan: registration mode is %d\n", arlan
->registrationMode
, u_char
);
234 printk("arlan: name= ");
237 for (i
= 0; i
< 16; i
++)
240 READSHM(c
, arlan
->name
[i
], char);
246 // ARLAN_DEBUG_EXIT("arlan_print_diagnostic_info");
251 /****************************** TEST MEMORY **************/
253 static int arlan_hw_test_memory(struct net_device
*dev
)
257 int memlen
= sizeof(struct arlan_shmem
) - 0xF; /* avoid control register */
258 volatile char *arlan_mem
= (char *) (dev
->mem_start
);
259 struct arlan_private
*priv
= netdev_priv(dev
);
260 volatile struct arlan_shmem __iomem
*arlan
= priv
->card
;
265 /* hold card in reset state */
266 setHardwareReset(dev
);
270 for (i
= 0; i
< memlen
; i
++)
271 WRITESHM(arlan_mem
[i
], ((u_char
) pattern
++), u_char
);
274 for (i
= 0; i
< memlen
; i
++)
277 READSHM(res
, arlan_mem
[i
], char);
278 if (res
!= pattern
++)
280 printk(KERN_ERR
"Arlan driver memory test 1 failed \n");
286 for (i
= 0; i
< memlen
; i
++)
287 WRITESHM(arlan_mem
[i
], ~(pattern
++), char);
290 for (i
= 0; i
< memlen
; i
++)
293 READSHM(res
, arlan_mem
[i
], char);
294 if (res
!= ~(pattern
++))
296 printk(KERN_ERR
"Arlan driver memory test 2 failed \n");
302 for (i
= 0; i
< memlen
; i
++)
303 WRITESHM(arlan_mem
[i
], 0x00, char);
305 IFDEBUG(1) printk(KERN_INFO
"Arlan: memory tests ok\n");
307 /* set reset flag and then release reset */
308 WRITESHM(arlan
->resetFlag
, 0xff, u_char
);
310 clearChannelAttention(dev
);
311 clearHardwareReset(dev
);
313 /* wait for reset flag to become zero, we'll wait for two seconds */
314 if (arlan_command(dev
, ARLAN_COMMAND_LONG_WAIT_NOW
))
316 printk(KERN_ERR
"%s arlan: failed to come back from memory test\n", dev
->name
);
322 static int arlan_setup_card_by_book(struct net_device
*dev
)
324 u_char irqLevel
, configuredStatusFlag
;
325 struct arlan_private
*priv
= netdev_priv(dev
);
326 volatile struct arlan_shmem __iomem
*arlan
= priv
->card
;
328 // ARLAN_DEBUG_ENTRY("arlan_setup_card");
330 READSHM(configuredStatusFlag
, arlan
->configuredStatusFlag
, u_char
);
333 if (configuredStatusFlag
!= 0)
334 IFDEBUG(10) printk("arlan: CARD IS CONFIGURED\n");
336 IFDEBUG(10) printk("arlan: card is NOT configured\n");
338 if (testMemory
|| (READSHMB(arlan
->diagnosticInfo
) != 0xff))
339 if (arlan_hw_test_memory(dev
))
342 DEBUGSHM(4, "arlan configuredStatus = %d \n", arlan
->configuredStatusFlag
, u_char
);
343 DEBUGSHM(4, "arlan driver diagnostic: 0x%2x\n", arlan
->diagnosticInfo
, u_char
);
345 /* issue nop command - no interrupt */
346 arlan_command(dev
, ARLAN_COMMAND_NOOP
);
347 if (arlan_command(dev
, ARLAN_COMMAND_WAIT_NOW
) != 0)
350 IFDEBUG(50) printk("1st Noop successfully executed !!\n");
352 /* try to turn on the arlan interrupts */
353 clearClearInterrupt(dev
);
354 setClearInterrupt(dev
);
355 setInterruptEnable(dev
);
357 /* issue nop command - with interrupt */
359 arlan_command(dev
, ARLAN_COMMAND_NOOPINT
);
360 if (arlan_command(dev
, ARLAN_COMMAND_WAIT_NOW
) != 0)
364 IFDEBUG(50) printk("2nd Noop successfully executed !!\n");
366 READSHM(irqLevel
, arlan
->irqLevel
, u_char
)
368 if (irqLevel
!= dev
->irq
)
370 IFDEBUG(1) printk(KERN_WARNING
"arlan dip switches set irq to %d\n", irqLevel
);
371 printk(KERN_WARNING
"device driver irq set to %d - does not match\n", dev
->irq
);
375 IFDEBUG(2) printk("irq level is OK\n");
378 IFDEBUG(3) arlan_print_diagnostic_info(dev
);
380 arlan_command(dev
, ARLAN_COMMAND_CONF
);
382 READSHM(configuredStatusFlag
, arlan
->configuredStatusFlag
, u_char
);
383 if (configuredStatusFlag
== 0)
385 printk(KERN_WARNING
"arlan configure failed\n");
388 arlan_command(dev
, ARLAN_COMMAND_LONG_WAIT_NOW
);
389 arlan_command(dev
, ARLAN_COMMAND_RX
);
390 arlan_command(dev
, ARLAN_COMMAND_LONG_WAIT_NOW
);
391 printk(KERN_NOTICE
"%s: arlan driver version %s loaded\n",
392 dev
->name
, arlan_version
);
394 // ARLAN_DEBUG_EXIT("arlan_setup_card");
396 return 0; /* no errors */
400 #ifdef ARLAN_PROC_INTERFACE
401 #ifdef ARLAN_PROC_SHM_DUMP
403 static char arlan_drive_info
[ARLAN_STR_SIZE
] = "A655\n\0";
405 static int arlan_sysctl_info(ctl_table
* ctl
, int write
, struct file
*filp
,
406 void __user
*buffer
, size_t * lenp
, loff_t
*ppos
)
409 int retv
, pos
, devnum
;
410 struct arlan_private
*priva
= NULL
;
411 struct net_device
*dev
;
416 for (i
= 0; i
< 100; i
++)
417 printk("adi %x \n", arlan_drive_info
[i
]);
419 if (ctl
->procname
== NULL
|| arlan_drive_info
== NULL
)
421 printk(KERN_WARNING
" procname is NULL in sysctl_table or arlan_drive_info is NULL \n at arlan module\n ");
424 devnum
= ctl
->procname
[5] - '0';
425 if (devnum
< 0 || devnum
> MAX_ARLANS
- 1)
427 printk(KERN_WARNING
"too strange devnum in procfs parse\n ");
430 else if (arlan_device
[devnum
] == NULL
)
433 pos
+= sprintf(arlan_drive_info
+ pos
, "\t%s\n\n", ctl
->procname
);
434 pos
+= sprintf(arlan_drive_info
+ pos
, "No device found here \n");
438 priva
= netdev_priv(arlan_device
[devnum
]);
442 printk(KERN_WARNING
" Could not find the device private in arlan procsys, bad\n ");
445 dev
= arlan_device
[devnum
];
447 memcpy_fromio(priva
->conf
, priva
->card
, sizeof(struct arlan_shmem
));
449 pos
= sprintf(arlan_drive_info
, "Arlan info \n");
450 /* Header Signature */
451 SARLSTR(textRegion
, 48);
453 pos
+= sprintf(arlan_drive_info
+ pos
, "diagnosticInfo\t=\t%s \n", arlan_diagnostic_info_string(dev
));
454 SARLUC(diagnosticInfo
);
455 SARLUS(diagnosticOffset
);
457 SARLUCN(lanCardNodeId
, 6);
458 SARLUCN(broadcastAddress
, 6);
459 pos
+= sprintf(arlan_drive_info
+ pos
, "hardwareType =\t %s \n", arlan_hardware_type_string(dev
));
460 SARLUC(hardwareType
);
461 SARLUC(majorHardwareVersion
);
462 SARLUC(minorHardwareVersion
);
464 SARLUC(defaultChannelSet
);
467 /* Control/Status Block - 0x0080 */
468 SARLUC(interruptInProgress
);
469 SARLUC(cntrlRegImage
);
473 SARLUCN(commandParameter
, 15);
475 /* Receive Status - 0x00a0 */
481 SARLUC(rxBroadcastFlag
);
486 /* Transmit Status - 0x00b0 */
488 SARLUC(txAckQuality
);
491 SARLUCN(registeredRouter
, 6);
492 SARLUCN(backboneRouter
, 6);
493 SARLUC(registrationStatus
);
494 SARLUC(configuredStatusFlag
);
496 SARLUCN(ultimateDestAddress
, 6);
497 SARLUCN(immedDestAddress
, 6);
498 SARLUCN(immedSrcAddress
, 6);
499 SARLUS(rxSequenceNumber
);
500 SARLUC(assignedLocaltalkAddress
);
503 /* System Parameter Block */
505 /* - Driver Parameters (Novell Specific) */
508 SARLUS(transportTime
);
511 /* - Configuration Parameters */
513 SARLUC(spreadingCode
);
515 SARLUC(channelNumber
);
518 SARLUC(scramblingDisable
);
522 SARLUC(txAttenuation
);
524 SARLUS(globalChecksum
);
526 SARLUS(maxDatagramSize
);
527 SARLUS(maxFrameSize
);
531 SARLUC(rootOrRepeater
);
532 SARLUCN(specifiedRouter
, 6);
533 SARLUS(fastPollPeriod
);
535 SARLUSA(fastPollDelay
);
536 SARLUC(arlThreshold
);
539 SARLUS(specRouterTimeout
);
544 SARLUCN(encryptionKey
, 12);
550 SARLUS(sectionChecksum
);
552 SARLUC(registrationMode
);
553 SARLUC(registrationFill
);
555 SARLUS(refreshPeriod
);
558 SARLUC(localTalkAddress
);
567 /* SARLUCN( _16, 0x140);
569 /* Statistics Block - 0x0300 */
572 SARLUCN(resetTime
, 18);
573 SARLUIA(numDatagramsTransmitted
);
574 SARLUIA(numReTransmissions
);
575 SARLUIA(numFramesDiscarded
);
576 SARLUIA(numDatagramsReceived
);
577 SARLUIA(numDuplicateReceivedFrames
);
578 SARLUIA(numDatagramsDiscarded
);
579 SARLUS(maxNumReTransmitDatagram
);
580 SARLUS(maxNumReTransmitFrames
);
581 SARLUS(maxNumConsecutiveDuplicateFrames
);
582 /* misaligned here so we have to go to characters */
583 SARLUIA(numBytesTransmitted
);
584 SARLUIA(numBytesReceived
);
585 SARLUIA(numCRCErrors
);
586 SARLUIA(numLengthErrors
);
587 SARLUIA(numAbortErrors
);
588 SARLUIA(numTXUnderruns
);
589 SARLUIA(numRXOverruns
);
590 SARLUIA(numHoldOffs
);
591 SARLUIA(numFramesTransmitted
);
592 SARLUIA(numFramesReceived
);
593 SARLUIA(numReceiveFramesLost
);
594 SARLUIA(numRXBufferOverflows
);
595 SARLUIA(numFramesDiscardedAddrMismatch
);
596 SARLUIA(numFramesDiscardedSIDMismatch
);
597 SARLUIA(numPollsTransmistted
);
598 SARLUIA(numPollAcknowledges
);
599 SARLUIA(numStatusTimeouts
);
600 SARLUIA(numNACKReceived
);
606 /* next 4 seems too long for procfs, over single page ?
608 SARLUCN( txBuffer, 0x800);
609 SARLUCN( rxBuffer, 0x800);
610 SARLUCN( _18, 0x0bff);
613 pos
+= sprintf(arlan_drive_info
+ pos
, "rxRing\t=\t0x");
614 for (i
= 0; i
< 0x50; i
++)
615 pos
+= sprintf(arlan_drive_info
+ pos
, "%02x", ((char *) priva
->conf
)[priva
->conf
->rxOffset
+ i
]);
616 pos
+= sprintf(arlan_drive_info
+ pos
, "\n");
618 SARLUC(configStatus
);
622 SARLUC(controlRegister
);
624 pos
+= sprintf(arlan_drive_info
+ pos
, " total %d chars\n", pos
);
627 pos
+= sprintf(arlan_drive_info
+ pos
, " driver name : %s\n", ctl
->procname
);
632 retv
= proc_dostring(ctl
, write
, filp
, buffer
, lenp
, ppos
);
642 static int arlan_sysctl_info161719(ctl_table
* ctl
, int write
, struct file
*filp
,
643 void __user
*buffer
, size_t * lenp
, loff_t
*ppos
)
646 int retv
, pos
, devnum
;
647 struct arlan_private
*priva
= NULL
;
650 devnum
= ctl
->procname
[5] - '0';
651 if (arlan_device
[devnum
] == NULL
)
653 pos
+= sprintf(arlan_drive_info
+ pos
, "No device found here \n");
657 priva
= netdev_priv(arlan_device
[devnum
]);
660 printk(KERN_WARNING
" Could not find the device private in arlan procsys, bad\n ");
663 memcpy_fromio(priva
->conf
, priva
->card
, sizeof(struct arlan_shmem
));
672 retv
= proc_dostring(ctl
, write
, filp
, buffer
, lenp
, ppos
);
676 static int arlan_sysctl_infotxRing(ctl_table
* ctl
, int write
, struct file
*filp
,
677 void __user
*buffer
, size_t * lenp
, loff_t
*ppos
)
680 int retv
, pos
, devnum
;
681 struct arlan_private
*priva
= NULL
;
684 devnum
= ctl
->procname
[5] - '0';
685 if (arlan_device
[devnum
] == NULL
)
687 pos
+= sprintf(arlan_drive_info
+ pos
, "No device found here \n");
691 priva
= netdev_priv(arlan_device
[devnum
]);
694 printk(KERN_WARNING
" Could not find the device private in arlan procsys, bad\n ");
697 memcpy_fromio(priva
->conf
, priva
->card
, sizeof(struct arlan_shmem
));
698 SARLBNpln(u_char
, txBuffer
, 0x800);
701 retv
= proc_dostring(ctl
, write
, filp
, buffer
, lenp
, ppos
);
705 static int arlan_sysctl_inforxRing(ctl_table
* ctl
, int write
, struct file
*filp
,
706 void __user
*buffer
, size_t * lenp
, loff_t
*ppos
)
709 int retv
, pos
, devnum
;
710 struct arlan_private
*priva
= NULL
;
713 devnum
= ctl
->procname
[5] - '0';
714 if (arlan_device
[devnum
] == NULL
)
716 pos
+= sprintf(arlan_drive_info
+ pos
, "No device found here \n");
719 priva
= netdev_priv(arlan_device
[devnum
]);
722 printk(KERN_WARNING
" Could not find the device private in arlan procsys, bad\n ");
725 memcpy_fromio(priva
->conf
, priva
->card
, sizeof(struct arlan_shmem
));
726 SARLBNpln(u_char
, rxBuffer
, 0x800);
729 retv
= proc_dostring(ctl
, write
, filp
, buffer
, lenp
, ppos
);
733 static int arlan_sysctl_info18(ctl_table
* ctl
, int write
, struct file
*filp
,
734 void __user
*buffer
, size_t * lenp
, loff_t
*ppos
)
737 int retv
, pos
, devnum
;
738 struct arlan_private
*priva
= NULL
;
741 devnum
= ctl
->procname
[5] - '0';
742 if (arlan_device
[devnum
] == NULL
)
744 pos
+= sprintf(arlan_drive_info
+ pos
, "No device found here \n");
748 priva
= netdev_priv(arlan_device
[devnum
]);
751 printk(KERN_WARNING
" Could not find the device private in arlan procsys, bad\n ");
754 memcpy_fromio(priva
->conf
, priva
->card
, sizeof(struct arlan_shmem
));
755 SARLBNpln(u_char
, _18
, 0x800);
759 retv
= proc_dostring(ctl
, write
, filp
, buffer
, lenp
, ppos
);
764 #endif /* #ifdef ARLAN_PROC_SHM_DUMP */
767 static char conf_reset_result
[200];
769 static int arlan_configure(ctl_table
* ctl
, int write
, struct file
*filp
,
770 void __user
*buffer
, size_t * lenp
, loff_t
*ppos
)
773 int devnum
= ctl
->procname
[6] - '0';
774 struct arlan_private
*priv
;
776 if (devnum
< 0 || devnum
> MAX_ARLANS
- 1)
778 printk(KERN_WARNING
"too strange devnum in procfs parse\n ");
781 else if (arlan_device
[devnum
] != NULL
)
783 priv
= netdev_priv(arlan_device
[devnum
]);
785 arlan_command(arlan_device
[devnum
], ARLAN_COMMAND_CLEAN_AND_CONF
);
791 return proc_dostring(ctl
, write
, filp
, buffer
, lenp
, ppos
);
794 static int arlan_sysctl_reset(ctl_table
* ctl
, int write
, struct file
*filp
,
795 void __user
*buffer
, size_t * lenp
, loff_t
*ppos
)
798 int devnum
= ctl
->procname
[5] - '0';
799 struct arlan_private
*priv
;
801 if (devnum
< 0 || devnum
> MAX_ARLANS
- 1)
803 printk(KERN_WARNING
"too strange devnum in procfs parse\n ");
806 else if (arlan_device
[devnum
] != NULL
)
808 priv
= netdev_priv(arlan_device
[devnum
]);
809 arlan_command(arlan_device
[devnum
], ARLAN_COMMAND_CLEAN_AND_RESET
);
814 return proc_dostring(ctl
, write
, filp
, buffer
, lenp
, ppos
);
818 /* Place files in /proc/sys/dev/arlan */
819 #define CTBLN(num,card,nam) \
822 .data = &(arlan_conf[card].nam),\
823 .maxlen = sizeof(int), .mode = 0600, .proc_handler = &proc_dointvec}
824 #ifdef ARLAN_DEBUGGING
826 #define ARLAN_PROC_DEBUG_ENTRIES \
827 { .ctl_name = 48, .procname = "entry_exit_debug",\
828 .data = &arlan_entry_and_exit_debug,\
829 .maxlen = sizeof(int), .mode = 0600, .proc_handler = &proc_dointvec},\
830 { .ctl_name = 49, .procname = "debug", .data = &arlan_debug,\
831 .maxlen = sizeof(int), .mode = 0600, .proc_handler = &proc_dointvec},
833 #define ARLAN_PROC_DEBUG_ENTRIES
836 #define ARLAN_SYSCTL_TABLE_TOTAL(cardNo)\
837 CTBLN(1,cardNo,spreadingCode),\
838 CTBLN(2,cardNo, channelNumber),\
839 CTBLN(3,cardNo, scramblingDisable),\
840 CTBLN(4,cardNo, txAttenuation),\
841 CTBLN(5,cardNo, systemId), \
842 CTBLN(6,cardNo, maxDatagramSize),\
843 CTBLN(7,cardNo, maxFrameSize),\
844 CTBLN(8,cardNo, maxRetries),\
845 CTBLN(9,cardNo, receiveMode),\
846 CTBLN(10,cardNo, priority),\
847 CTBLN(11,cardNo, rootOrRepeater),\
848 CTBLN(12,cardNo, SID),\
849 CTBLN(13,cardNo, registrationMode),\
850 CTBLN(14,cardNo, registrationFill),\
851 CTBLN(15,cardNo, localTalkAddress),\
852 CTBLN(16,cardNo, codeFormat),\
853 CTBLN(17,cardNo, numChannels),\
854 CTBLN(18,cardNo, channel1),\
855 CTBLN(19,cardNo, channel2),\
856 CTBLN(20,cardNo, channel3),\
857 CTBLN(21,cardNo, channel4),\
858 CTBLN(22,cardNo, txClear),\
859 CTBLN(23,cardNo, txRetries),\
860 CTBLN(24,cardNo, txRouting),\
861 CTBLN(25,cardNo, txScrambled),\
862 CTBLN(26,cardNo, rxParameter),\
863 CTBLN(27,cardNo, txTimeoutMs),\
864 CTBLN(28,cardNo, waitCardTimeout),\
865 CTBLN(29,cardNo, channelSet), \
866 {.ctl_name = 30, .procname = "name",\
867 .data = arlan_conf[cardNo].siteName,\
868 .maxlen = 16, .mode = 0600, .proc_handler = &proc_dostring},\
869 CTBLN(31,cardNo,waitTime),\
870 CTBLN(32,cardNo,lParameter),\
871 CTBLN(33,cardNo,_15),\
872 CTBLN(34,cardNo,headerSize),\
873 CTBLN(36,cardNo,tx_delay_ms),\
874 CTBLN(37,cardNo,retries),\
875 CTBLN(38,cardNo,ReTransmitPacketMaxSize),\
876 CTBLN(39,cardNo,waitReTransmitPacketMaxSize),\
877 CTBLN(40,cardNo,fastReTransCount),\
878 CTBLN(41,cardNo,driverRetransmissions),\
879 CTBLN(42,cardNo,txAckTimeoutMs),\
880 CTBLN(43,cardNo,registrationInterrupts),\
881 CTBLN(44,cardNo,hardwareType),\
882 CTBLN(45,cardNo,radioType),\
883 CTBLN(46,cardNo,writeEEPROM),\
884 CTBLN(47,cardNo,writeRadioType),\
885 ARLAN_PROC_DEBUG_ENTRIES\
886 CTBLN(50,cardNo,in_speed),\
887 CTBLN(51,cardNo,out_speed),\
888 CTBLN(52,cardNo,in_speed10),\
889 CTBLN(53,cardNo,out_speed10),\
890 CTBLN(54,cardNo,in_speed_max),\
891 CTBLN(55,cardNo,out_speed_max),\
892 CTBLN(56,cardNo,measure_rate),\
893 CTBLN(57,cardNo,pre_Command_Wait),\
894 CTBLN(58,cardNo,rx_tweak1),\
895 CTBLN(59,cardNo,rx_tweak2),\
896 CTBLN(60,cardNo,tx_queue_len),\
900 static ctl_table arlan_conf_table0[] =
902 ARLAN_SYSCTL_TABLE_TOTAL(0)
904 #ifdef ARLAN_PROC_SHM_DUMP
907 .procname
= "arlan0-txRing",
908 .data
= &arlan_drive_info
,
909 .maxlen
= ARLAN_STR_SIZE
,
911 .proc_handler
= &arlan_sysctl_infotxRing
,
915 .procname
= "arlan0-rxRing",
916 .data
= &arlan_drive_info
,
917 .maxlen
= ARLAN_STR_SIZE
,
919 .proc_handler
= &arlan_sysctl_inforxRing
,
923 .procname
= "arlan0-18",
924 .data
= &arlan_drive_info
,
925 .maxlen
= ARLAN_STR_SIZE
,
927 .proc_handler
= &arlan_sysctl_info18
,
931 .procname
= "arlan0-ring",
932 .data
= &arlan_drive_info
,
933 .maxlen
= ARLAN_STR_SIZE
,
935 .proc_handler
= &arlan_sysctl_info161719
,
939 .procname
= "arlan0-shm-cpy",
940 .data
= &arlan_drive_info
,
941 .maxlen
= ARLAN_STR_SIZE
,
943 .proc_handler
= &arlan_sysctl_info
,
948 .procname
= "config0",
949 .data
= &conf_reset_result
,
952 .proc_handler
= &arlan_configure
956 .procname
= "reset0",
957 .data
= &conf_reset_result
,
960 .proc_handler
= &arlan_sysctl_reset
,
965 static ctl_table arlan_conf_table1
[] =
968 ARLAN_SYSCTL_TABLE_TOTAL(1)
970 #ifdef ARLAN_PROC_SHM_DUMP
973 .procname
= "arlan1-txRing",
974 .data
= &arlan_drive_info
,
975 .maxlen
= ARLAN_STR_SIZE
,
977 .proc_handler
= &arlan_sysctl_infotxRing
,
981 .procname
= "arlan1-rxRing",
982 .data
= &arlan_drive_info
,
983 .maxlen
= ARLAN_STR_SIZE
,
985 .proc_handler
= &arlan_sysctl_inforxRing
,
989 .procname
= "arlan1-18",
990 .data
= &arlan_drive_info
,
991 .maxlen
= ARLAN_STR_SIZE
,
993 .proc_handler
= &arlan_sysctl_info18
,
997 .procname
= "arlan1-ring",
998 .data
= &arlan_drive_info
,
999 .maxlen
= ARLAN_STR_SIZE
,
1001 .proc_handler
= &arlan_sysctl_info161719
,
1005 .procname
= "arlan1-shm-cpy",
1006 .data
= &arlan_drive_info
,
1007 .maxlen
= ARLAN_STR_SIZE
,
1009 .proc_handler
= &arlan_sysctl_info
,
1014 .procname
= "config1",
1015 .data
= &conf_reset_result
,
1018 .proc_handler
= &arlan_configure
,
1022 .procname
= "reset1",
1023 .data
= &conf_reset_result
,
1026 .proc_handler
= &arlan_sysctl_reset
,
1031 static ctl_table arlan_conf_table2
[] =
1034 ARLAN_SYSCTL_TABLE_TOTAL(2)
1036 #ifdef ARLAN_PROC_SHM_DUMP
1039 .procname
= "arlan2-txRing",
1040 .data
= &arlan_drive_info
,
1041 .maxlen
= ARLAN_STR_SIZE
,
1043 .proc_handler
= &arlan_sysctl_infotxRing
,
1047 .procname
= "arlan2-rxRing",
1048 .data
= &arlan_drive_info
,
1049 .maxlen
= ARLAN_STR_SIZE
,
1051 .proc_handler
= &arlan_sysctl_inforxRing
,
1055 .procname
= "arlan2-18",
1056 .data
= &arlan_drive_info
,
1057 .maxlen
= ARLAN_STR_SIZE
,
1059 .proc_handler
= &arlan_sysctl_info18
,
1063 .procname
= "arlan2-ring",
1064 .data
= &arlan_drive_info
,
1065 .maxlen
= ARLAN_STR_SIZE
,
1067 .proc_handler
= &arlan_sysctl_info161719
,
1071 .procname
= "arlan2-shm-cpy",
1072 .data
= &arlan_drive_info
,
1073 .maxlen
= ARLAN_STR_SIZE
,
1075 .proc_handler
= &arlan_sysctl_info
,
1080 .procname
= "config2",
1081 .data
= &conf_reset_result
,
1084 .proc_handler
= &arlan_configure
,
1088 .procname
= "reset2",
1089 .data
= &conf_reset_result
,
1092 .proc_handler
= &arlan_sysctl_reset
,
1097 static ctl_table arlan_conf_table3
[] =
1100 ARLAN_SYSCTL_TABLE_TOTAL(3)
1102 #ifdef ARLAN_PROC_SHM_DUMP
1105 .procname
= "arlan3-txRing",
1106 .data
= &arlan_drive_info
,
1107 .maxlen
= ARLAN_STR_SIZE
,
1109 .proc_handler
= &arlan_sysctl_infotxRing
,
1113 .procname
= "arlan3-rxRing",
1114 .data
= &arlan_drive_info
,
1115 .maxlen
= ARLAN_STR_SIZE
,
1117 .proc_handler
= &arlan_sysctl_inforxRing
,
1121 .procname
= "arlan3-18",
1122 .data
= &arlan_drive_info
,
1123 .maxlen
= ARLAN_STR_SIZE
,
1125 .proc_handler
= &arlan_sysctl_info18
,
1129 .procname
= "arlan3-ring",
1130 .data
= &arlan_drive_info
,
1131 .maxlen
= ARLAN_STR_SIZE
,
1133 .proc_handler
= &arlan_sysctl_info161719
,
1137 .procname
= "arlan3-shm-cpy",
1138 .data
= &arlan_drive_info
,
1139 .maxlen
= ARLAN_STR_SIZE
,
1141 .proc_handler
= &arlan_sysctl_info
,
1146 .procname
= "config3",
1147 .data
= &conf_reset_result
,
1150 .proc_handler
= &arlan_configure
,
1154 .procname
= "reset3",
1155 .data
= &conf_reset_result
,
1158 .proc_handler
= &arlan_sysctl_reset
,
1165 static ctl_table arlan_table
[] =
1169 .procname
= "arlan0",
1172 .child
= arlan_conf_table0
,
1176 .procname
= "arlan1",
1179 .child
= arlan_conf_table1
,
1183 .procname
= "arlan2",
1186 .child
= arlan_conf_table2
,
1190 .procname
= "arlan3",
1193 .child
= arlan_conf_table3
,
1200 static ctl_table arlan_table
[MAX_ARLANS
+ 1] =
1207 static ctl_table arlan_table
[MAX_ARLANS
+ 1] =
1214 // static int mmtu = 1234;
1216 static ctl_table arlan_root_table
[] =
1219 .ctl_name
= CTL_ARLAN
,
1220 .procname
= "arlan",
1223 .child
= arlan_table
,
1228 /* Make sure that /proc/sys/dev is there */
1229 //static ctl_table arlan_device_root_table[] =
1231 // {CTL_DEV, "dev", NULL, 0, 0555, arlan_root_table},
1236 #ifdef CONFIG_PROC_FS
1237 static struct ctl_table_header
*arlan_device_sysctl_header
;
1239 int __init
init_arlan_proc(void)
1243 if (arlan_device_sysctl_header
)
1245 for (i
= 0; i
< MAX_ARLANS
&& arlan_device
[i
]; i
++)
1246 arlan_table
[i
].ctl_name
= i
+ 1;
1247 arlan_device_sysctl_header
= register_sysctl_table(arlan_root_table
);
1248 if (!arlan_device_sysctl_header
)
1255 void __exit
cleanup_arlan_proc(void)
1257 unregister_sysctl_table(arlan_device_sysctl_header
);
1258 arlan_device_sysctl_header
= NULL
;