arlan-proc.c 29 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261
  1. #include "arlan.h"
  2. #include <linux/sysctl.h>
  3. #ifdef CONFIG_PROC_FS
  4. /* void enableReceive(struct net_device* dev);
  5. */
  6. #define ARLAN_STR_SIZE 0x2ff0
  7. #define DEV_ARLAN_INFO 1
  8. #define DEV_ARLAN 1
  9. #define SARLG(type,var) {\
  10. pos += sprintf(arlan_drive_info+pos, "%s\t=\t0x%x\n", #var, READSHMB(priva->card->var)); \
  11. }
  12. #define SARLBN(type,var,nn) {\
  13. pos += sprintf(arlan_drive_info+pos, "%s\t=\t0x",#var);\
  14. for (i=0; i < nn; i++ ) pos += sprintf(arlan_drive_info+pos, "%02x",READSHMB(priva->card->var[i]));\
  15. pos += sprintf(arlan_drive_info+pos, "\n"); \
  16. }
  17. #define SARLBNpln(type,var,nn) {\
  18. for (i=0; i < nn; i++ ) pos += sprintf(arlan_drive_info+pos, "%02x",READSHMB(priva->card->var[i]));\
  19. }
  20. #define SARLSTR(var,nn) {\
  21. char tmpStr[400];\
  22. int tmpLn = nn;\
  23. if (nn > 399 ) tmpLn = 399; \
  24. memcpy(tmpStr,(char *) priva->conf->var,tmpLn);\
  25. tmpStr[tmpLn] = 0; \
  26. pos += sprintf(arlan_drive_info+pos, "%s\t=\t%s \n",#var,priva->conf->var);\
  27. }
  28. #define SARLUC(var) SARLG(u_char, var)
  29. #define SARLUCN(var,nn) SARLBN(u_char,var, nn)
  30. #define SARLUS(var) SARLG(u_short, var)
  31. #define SARLUSN(var,nn) SARLBN(u_short,var, nn)
  32. #define SARLUI(var) SARLG(u_int, var)
  33. #define SARLUSA(var) {\
  34. u_short tmpVar;\
  35. memcpy(&tmpVar, (short *) priva->conf->var,2); \
  36. pos += sprintf(arlan_drive_info+pos, "%s\t=\t0x%x\n",#var, tmpVar);\
  37. }
  38. #define SARLUIA(var) {\
  39. u_int tmpVar;\
  40. memcpy(&tmpVar, (int* )priva->conf->var,4); \
  41. pos += sprintf(arlan_drive_info+pos, "%s\t=\t0x%x\n",#var, tmpVar);\
  42. }
  43. static const char *arlan_diagnostic_info_string(struct net_device *dev)
  44. {
  45. struct arlan_private *priv = netdev_priv(dev);
  46. volatile struct arlan_shmem __iomem *arlan = priv->card;
  47. u_char diagnosticInfo;
  48. READSHM(diagnosticInfo, arlan->diagnosticInfo, u_char);
  49. switch (diagnosticInfo)
  50. {
  51. case 0xFF:
  52. return "Diagnostic info is OK";
  53. case 0xFE:
  54. return "ERROR EPROM Checksum error ";
  55. case 0xFD:
  56. return "ERROR Local Ram Test Failed ";
  57. case 0xFC:
  58. return "ERROR SCC failure ";
  59. case 0xFB:
  60. return "ERROR BackBone failure ";
  61. case 0xFA:
  62. return "ERROR transceiver not found ";
  63. case 0xF9:
  64. return "ERROR no more address space ";
  65. case 0xF8:
  66. return "ERROR Checksum error ";
  67. case 0xF7:
  68. return "ERROR Missing SS Code";
  69. case 0xF6:
  70. return "ERROR Invalid config format";
  71. case 0xF5:
  72. return "ERROR Reserved errorcode F5";
  73. case 0xF4:
  74. return "ERROR Invalid spreading code/channel number";
  75. case 0xF3:
  76. return "ERROR Load Code Error";
  77. case 0xF2:
  78. return "ERROR Reserver errorcode F2 ";
  79. case 0xF1:
  80. return "ERROR Invalid command receivec by LAN card ";
  81. case 0xF0:
  82. return "ERROR Invalid parameter found in command ";
  83. case 0xEF:
  84. return "ERROR On-chip timer failure ";
  85. case 0xEE:
  86. return "ERROR T410 timer failure ";
  87. case 0xED:
  88. return "ERROR Too Many TxEnable commands ";
  89. case 0xEC:
  90. return "ERROR EEPROM error on radio module ";
  91. default:
  92. return "ERROR unknown Diagnostic info reply code ";
  93. }
  94. }
  95. static const char *arlan_hardware_type_string(struct net_device *dev)
  96. {
  97. u_char hardwareType;
  98. struct arlan_private *priv = netdev_priv(dev);
  99. volatile struct arlan_shmem __iomem *arlan = priv->card;
  100. READSHM(hardwareType, arlan->hardwareType, u_char);
  101. switch (hardwareType)
  102. {
  103. case 0x00:
  104. return "type A450";
  105. case 0x01:
  106. return "type A650 ";
  107. case 0x04:
  108. return "type TMA coproc";
  109. case 0x0D:
  110. return "type A650E ";
  111. case 0x18:
  112. return "type TMA coproc Australian";
  113. case 0x19:
  114. return "type A650A ";
  115. case 0x26:
  116. return "type TMA coproc European";
  117. case 0x2E:
  118. return "type A655 ";
  119. case 0x2F:
  120. return "type A655A ";
  121. case 0x30:
  122. return "type A655E ";
  123. case 0x0B:
  124. return "type A670 ";
  125. case 0x0C:
  126. return "type A670E ";
  127. case 0x2D:
  128. return "type A670A ";
  129. case 0x0F:
  130. return "type A411T";
  131. case 0x16:
  132. return "type A411TA";
  133. case 0x1B:
  134. return "type A440T";
  135. case 0x1C:
  136. return "type A412T";
  137. case 0x1E:
  138. return "type A412TA";
  139. case 0x22:
  140. return "type A411TE";
  141. case 0x24:
  142. return "type A412TE";
  143. case 0x27:
  144. return "type A671T ";
  145. case 0x29:
  146. return "type A671TA ";
  147. case 0x2B:
  148. return "type A671TE ";
  149. case 0x31:
  150. return "type A415T ";
  151. case 0x33:
  152. return "type A415TA ";
  153. case 0x35:
  154. return "type A415TE ";
  155. case 0x37:
  156. return "type A672";
  157. case 0x39:
  158. return "type A672A ";
  159. case 0x3B:
  160. return "type A672T";
  161. case 0x6B:
  162. return "type IC2200";
  163. default:
  164. return "type A672T";
  165. }
  166. }
  167. #ifdef ARLAN_DEBUGGING
  168. static void arlan_print_diagnostic_info(struct net_device *dev)
  169. {
  170. int i;
  171. u_char diagnosticInfo;
  172. u_short diagnosticOffset;
  173. u_char hardwareType;
  174. struct arlan_private *priv = netdev_priv(dev);
  175. volatile struct arlan_shmem __iomem *arlan = priv->card;
  176. // ARLAN_DEBUG_ENTRY("arlan_print_diagnostic_info");
  177. if (READSHMB(arlan->configuredStatusFlag) == 0)
  178. printk("Arlan: Card NOT configured\n");
  179. else
  180. printk("Arlan: Card is configured\n");
  181. READSHM(diagnosticInfo, arlan->diagnosticInfo, u_char);
  182. READSHM(diagnosticOffset, arlan->diagnosticOffset, u_short);
  183. printk(KERN_INFO "%s\n", arlan_diagnostic_info_string(dev));
  184. if (diagnosticInfo != 0xff)
  185. printk("%s arlan: Diagnostic Offset %d \n", dev->name, diagnosticOffset);
  186. printk("arlan: LAN CODE ID = ");
  187. for (i = 0; i < 6; i++)
  188. DEBUGSHM(1, "%03d:", arlan->lanCardNodeId[i], u_char);
  189. printk("\n");
  190. printk("arlan: Arlan BroadCast address = ");
  191. for (i = 0; i < 6; i++)
  192. DEBUGSHM(1, "%03d:", arlan->broadcastAddress[i], u_char);
  193. printk("\n");
  194. READSHM(hardwareType, arlan->hardwareType, u_char);
  195. printk(KERN_INFO "%s\n", arlan_hardware_type_string(dev));
  196. DEBUGSHM(1, "arlan: channelNumber=%d\n", arlan->channelNumber, u_char);
  197. DEBUGSHM(1, "arlan: channelSet=%d\n", arlan->channelSet, u_char);
  198. DEBUGSHM(1, "arlan: spreadingCode=%d\n", arlan->spreadingCode, u_char);
  199. DEBUGSHM(1, "arlan: radioNodeId=%d\n", arlan->radioNodeId, u_short);
  200. DEBUGSHM(1, "arlan: SID =%d\n", arlan->SID, u_short);
  201. DEBUGSHM(1, "arlan: rxOffset=%d\n", arlan->rxOffset, u_short);
  202. DEBUGSHM(1, "arlan: registration mode is %d\n", arlan->registrationMode, u_char);
  203. printk("arlan: name= ");
  204. IFDEBUG(1)
  205. for (i = 0; i < 16; i++)
  206. {
  207. char c;
  208. READSHM(c, arlan->name[i], char);
  209. if (c)
  210. printk("%c", c);
  211. }
  212. printk("\n");
  213. // ARLAN_DEBUG_EXIT("arlan_print_diagnostic_info");
  214. }
  215. /****************************** TEST MEMORY **************/
  216. static int arlan_hw_test_memory(struct net_device *dev)
  217. {
  218. u_char *ptr;
  219. int i;
  220. int memlen = sizeof(struct arlan_shmem) - 0xF; /* avoid control register */
  221. volatile char *arlan_mem = (char *) (dev->mem_start);
  222. struct arlan_private *priv = netdev_priv(dev);
  223. volatile struct arlan_shmem __iomem *arlan = priv->card;
  224. char pattern;
  225. ptr = NULL;
  226. /* hold card in reset state */
  227. setHardwareReset(dev);
  228. /* test memory */
  229. pattern = 0;
  230. for (i = 0; i < memlen; i++)
  231. WRITESHM(arlan_mem[i], ((u_char) pattern++), u_char);
  232. pattern = 0;
  233. for (i = 0; i < memlen; i++)
  234. {
  235. char res;
  236. READSHM(res, arlan_mem[i], char);
  237. if (res != pattern++)
  238. {
  239. printk(KERN_ERR "Arlan driver memory test 1 failed \n");
  240. return -1;
  241. }
  242. }
  243. pattern = 0;
  244. for (i = 0; i < memlen; i++)
  245. WRITESHM(arlan_mem[i], ~(pattern++), char);
  246. pattern = 0;
  247. for (i = 0; i < memlen; i++)
  248. {
  249. char res;
  250. READSHM(res, arlan_mem[i], char);
  251. if (res != ~(pattern++))
  252. {
  253. printk(KERN_ERR "Arlan driver memory test 2 failed \n");
  254. return -1;
  255. }
  256. }
  257. /* zero memory */
  258. for (i = 0; i < memlen; i++)
  259. WRITESHM(arlan_mem[i], 0x00, char);
  260. IFDEBUG(1) printk(KERN_INFO "Arlan: memory tests ok\n");
  261. /* set reset flag and then release reset */
  262. WRITESHM(arlan->resetFlag, 0xff, u_char);
  263. clearChannelAttention(dev);
  264. clearHardwareReset(dev);
  265. /* wait for reset flag to become zero, we'll wait for two seconds */
  266. if (arlan_command(dev, ARLAN_COMMAND_LONG_WAIT_NOW))
  267. {
  268. printk(KERN_ERR "%s arlan: failed to come back from memory test\n", dev->name);
  269. return -1;
  270. }
  271. return 0;
  272. }
  273. static int arlan_setup_card_by_book(struct net_device *dev)
  274. {
  275. u_char irqLevel, configuredStatusFlag;
  276. struct arlan_private *priv = netdev_priv(dev);
  277. volatile struct arlan_shmem __iomem *arlan = priv->card;
  278. // ARLAN_DEBUG_ENTRY("arlan_setup_card");
  279. READSHM(configuredStatusFlag, arlan->configuredStatusFlag, u_char);
  280. IFDEBUG(10)
  281. if (configuredStatusFlag != 0)
  282. IFDEBUG(10) printk("arlan: CARD IS CONFIGURED\n");
  283. else
  284. IFDEBUG(10) printk("arlan: card is NOT configured\n");
  285. if (testMemory || (READSHMB(arlan->diagnosticInfo) != 0xff))
  286. if (arlan_hw_test_memory(dev))
  287. return -1;
  288. DEBUGSHM(4, "arlan configuredStatus = %d \n", arlan->configuredStatusFlag, u_char);
  289. DEBUGSHM(4, "arlan driver diagnostic: 0x%2x\n", arlan->diagnosticInfo, u_char);
  290. /* issue nop command - no interrupt */
  291. arlan_command(dev, ARLAN_COMMAND_NOOP);
  292. if (arlan_command(dev, ARLAN_COMMAND_WAIT_NOW) != 0)
  293. return -1;
  294. IFDEBUG(50) printk("1st Noop successfully executed !!\n");
  295. /* try to turn on the arlan interrupts */
  296. clearClearInterrupt(dev);
  297. setClearInterrupt(dev);
  298. setInterruptEnable(dev);
  299. /* issue nop command - with interrupt */
  300. arlan_command(dev, ARLAN_COMMAND_NOOPINT);
  301. if (arlan_command(dev, ARLAN_COMMAND_WAIT_NOW) != 0)
  302. return -1;
  303. IFDEBUG(50) printk("2nd Noop successfully executed !!\n");
  304. READSHM(irqLevel, arlan->irqLevel, u_char)
  305. if (irqLevel != dev->irq)
  306. {
  307. IFDEBUG(1) printk(KERN_WARNING "arlan dip switches set irq to %d\n", irqLevel);
  308. printk(KERN_WARNING "device driver irq set to %d - does not match\n", dev->irq);
  309. dev->irq = irqLevel;
  310. }
  311. else
  312. IFDEBUG(2) printk("irq level is OK\n");
  313. IFDEBUG(3) arlan_print_diagnostic_info(dev);
  314. arlan_command(dev, ARLAN_COMMAND_CONF);
  315. READSHM(configuredStatusFlag, arlan->configuredStatusFlag, u_char);
  316. if (configuredStatusFlag == 0)
  317. {
  318. printk(KERN_WARNING "arlan configure failed\n");
  319. return -1;
  320. }
  321. arlan_command(dev, ARLAN_COMMAND_LONG_WAIT_NOW);
  322. arlan_command(dev, ARLAN_COMMAND_RX);
  323. arlan_command(dev, ARLAN_COMMAND_LONG_WAIT_NOW);
  324. printk(KERN_NOTICE "%s: arlan driver version %s loaded\n",
  325. dev->name, arlan_version);
  326. // ARLAN_DEBUG_EXIT("arlan_setup_card");
  327. return 0; /* no errors */
  328. }
  329. #endif
  330. #ifdef ARLAN_PROC_INTERFACE
  331. #ifdef ARLAN_PROC_SHM_DUMP
  332. static char arlan_drive_info[ARLAN_STR_SIZE] = "A655\n\0";
  333. static int arlan_sysctl_info(ctl_table * ctl, int write, struct file *filp,
  334. void __user *buffer, size_t * lenp, loff_t *ppos)
  335. {
  336. int i;
  337. int retv, pos, devnum;
  338. struct arlan_private *priva = NULL;
  339. struct net_device *dev;
  340. pos = 0;
  341. if (write)
  342. {
  343. printk("wrirte: ");
  344. for (i = 0; i < 100; i++)
  345. printk("adi %x \n", arlan_drive_info[i]);
  346. }
  347. if (ctl->procname == NULL || arlan_drive_info == NULL)
  348. {
  349. printk(KERN_WARNING " procname is NULL in sysctl_table or arlan_drive_info is NULL \n at arlan module\n ");
  350. return -1;
  351. }
  352. devnum = ctl->procname[5] - '0';
  353. if (devnum < 0 || devnum > MAX_ARLANS - 1)
  354. {
  355. printk(KERN_WARNING "too strange devnum in procfs parse\n ");
  356. return -1;
  357. }
  358. else if (arlan_device[devnum] == NULL)
  359. {
  360. if (ctl->procname)
  361. pos += sprintf(arlan_drive_info + pos, "\t%s\n\n", ctl->procname);
  362. pos += sprintf(arlan_drive_info + pos, "No device found here \n");
  363. goto final;
  364. }
  365. else
  366. priva = arlan_device[devnum]->priv;
  367. if (priva == NULL)
  368. {
  369. printk(KERN_WARNING " Could not find the device private in arlan procsys, bad\n ");
  370. return -1;
  371. }
  372. dev = arlan_device[devnum];
  373. memcpy_fromio(priva->conf, priva->card, sizeof(struct arlan_shmem));
  374. pos = sprintf(arlan_drive_info, "Arlan info \n");
  375. /* Header Signature */
  376. SARLSTR(textRegion, 48);
  377. SARLUC(resetFlag);
  378. pos += sprintf(arlan_drive_info + pos, "diagnosticInfo\t=\t%s \n", arlan_diagnostic_info_string(dev));
  379. SARLUC(diagnosticInfo);
  380. SARLUS(diagnosticOffset);
  381. SARLUCN(_1, 12);
  382. SARLUCN(lanCardNodeId, 6);
  383. SARLUCN(broadcastAddress, 6);
  384. pos += sprintf(arlan_drive_info + pos, "hardwareType =\t %s \n", arlan_hardware_type_string(dev));
  385. SARLUC(hardwareType);
  386. SARLUC(majorHardwareVersion);
  387. SARLUC(minorHardwareVersion);
  388. SARLUC(radioModule);
  389. SARLUC(defaultChannelSet);
  390. SARLUCN(_2, 47);
  391. /* Control/Status Block - 0x0080 */
  392. SARLUC(interruptInProgress);
  393. SARLUC(cntrlRegImage);
  394. SARLUCN(_3, 14);
  395. SARLUC(commandByte);
  396. SARLUCN(commandParameter, 15);
  397. /* Receive Status - 0x00a0 */
  398. SARLUC(rxStatus);
  399. SARLUC(rxFrmType);
  400. SARLUS(rxOffset);
  401. SARLUS(rxLength);
  402. SARLUCN(rxSrc, 6);
  403. SARLUC(rxBroadcastFlag);
  404. SARLUC(rxQuality);
  405. SARLUC(scrambled);
  406. SARLUCN(_4, 1);
  407. /* Transmit Status - 0x00b0 */
  408. SARLUC(txStatus);
  409. SARLUC(txAckQuality);
  410. SARLUC(numRetries);
  411. SARLUCN(_5, 14);
  412. SARLUCN(registeredRouter, 6);
  413. SARLUCN(backboneRouter, 6);
  414. SARLUC(registrationStatus);
  415. SARLUC(configuredStatusFlag);
  416. SARLUCN(_6, 1);
  417. SARLUCN(ultimateDestAddress, 6);
  418. SARLUCN(immedDestAddress, 6);
  419. SARLUCN(immedSrcAddress, 6);
  420. SARLUS(rxSequenceNumber);
  421. SARLUC(assignedLocaltalkAddress);
  422. SARLUCN(_7, 27);
  423. /* System Parameter Block */
  424. /* - Driver Parameters (Novell Specific) */
  425. SARLUS(txTimeout);
  426. SARLUS(transportTime);
  427. SARLUCN(_8, 4);
  428. /* - Configuration Parameters */
  429. SARLUC(irqLevel);
  430. SARLUC(spreadingCode);
  431. SARLUC(channelSet);
  432. SARLUC(channelNumber);
  433. SARLUS(radioNodeId);
  434. SARLUCN(_9, 2);
  435. SARLUC(scramblingDisable);
  436. SARLUC(radioType);
  437. SARLUS(routerId);
  438. SARLUCN(_10, 9);
  439. SARLUC(txAttenuation);
  440. SARLUIA(systemId);
  441. SARLUS(globalChecksum);
  442. SARLUCN(_11, 4);
  443. SARLUS(maxDatagramSize);
  444. SARLUS(maxFrameSize);
  445. SARLUC(maxRetries);
  446. SARLUC(receiveMode);
  447. SARLUC(priority);
  448. SARLUC(rootOrRepeater);
  449. SARLUCN(specifiedRouter, 6);
  450. SARLUS(fastPollPeriod);
  451. SARLUC(pollDecay);
  452. SARLUSA(fastPollDelay);
  453. SARLUC(arlThreshold);
  454. SARLUC(arlDecay);
  455. SARLUCN(_12, 1);
  456. SARLUS(specRouterTimeout);
  457. SARLUCN(_13, 5);
  458. /* Scrambled Area */
  459. SARLUIA(SID);
  460. SARLUCN(encryptionKey, 12);
  461. SARLUIA(_14);
  462. SARLUSA(waitTime);
  463. SARLUSA(lParameter);
  464. SARLUCN(_15, 3);
  465. SARLUS(headerSize);
  466. SARLUS(sectionChecksum);
  467. SARLUC(registrationMode);
  468. SARLUC(registrationFill);
  469. SARLUS(pollPeriod);
  470. SARLUS(refreshPeriod);
  471. SARLSTR(name, 16);
  472. SARLUCN(NID, 6);
  473. SARLUC(localTalkAddress);
  474. SARLUC(codeFormat);
  475. SARLUC(numChannels);
  476. SARLUC(channel1);
  477. SARLUC(channel2);
  478. SARLUC(channel3);
  479. SARLUC(channel4);
  480. SARLUCN(SSCode, 59);
  481. /* SARLUCN( _16, 0x140);
  482. */
  483. /* Statistics Block - 0x0300 */
  484. SARLUC(hostcpuLock);
  485. SARLUC(lancpuLock);
  486. SARLUCN(resetTime, 18);
  487. SARLUIA(numDatagramsTransmitted);
  488. SARLUIA(numReTransmissions);
  489. SARLUIA(numFramesDiscarded);
  490. SARLUIA(numDatagramsReceived);
  491. SARLUIA(numDuplicateReceivedFrames);
  492. SARLUIA(numDatagramsDiscarded);
  493. SARLUS(maxNumReTransmitDatagram);
  494. SARLUS(maxNumReTransmitFrames);
  495. SARLUS(maxNumConsecutiveDuplicateFrames);
  496. /* misaligned here so we have to go to characters */
  497. SARLUIA(numBytesTransmitted);
  498. SARLUIA(numBytesReceived);
  499. SARLUIA(numCRCErrors);
  500. SARLUIA(numLengthErrors);
  501. SARLUIA(numAbortErrors);
  502. SARLUIA(numTXUnderruns);
  503. SARLUIA(numRXOverruns);
  504. SARLUIA(numHoldOffs);
  505. SARLUIA(numFramesTransmitted);
  506. SARLUIA(numFramesReceived);
  507. SARLUIA(numReceiveFramesLost);
  508. SARLUIA(numRXBufferOverflows);
  509. SARLUIA(numFramesDiscardedAddrMismatch);
  510. SARLUIA(numFramesDiscardedSIDMismatch);
  511. SARLUIA(numPollsTransmistted);
  512. SARLUIA(numPollAcknowledges);
  513. SARLUIA(numStatusTimeouts);
  514. SARLUIA(numNACKReceived);
  515. SARLUS(auxCmd);
  516. SARLUCN(dumpPtr, 4);
  517. SARLUC(dumpVal);
  518. SARLUC(wireTest);
  519. /* next 4 seems too long for procfs, over single page ?
  520. SARLUCN( _17, 0x86);
  521. SARLUCN( txBuffer, 0x800);
  522. SARLUCN( rxBuffer, 0x800);
  523. SARLUCN( _18, 0x0bff);
  524. */
  525. pos += sprintf(arlan_drive_info + pos, "rxRing\t=\t0x");
  526. for (i = 0; i < 0x50; i++)
  527. pos += sprintf(arlan_drive_info + pos, "%02x", ((char *) priva->conf)[priva->conf->rxOffset + i]);
  528. pos += sprintf(arlan_drive_info + pos, "\n");
  529. SARLUC(configStatus);
  530. SARLUC(_22);
  531. SARLUC(progIOCtrl);
  532. SARLUC(shareMBase);
  533. SARLUC(controlRegister);
  534. pos += sprintf(arlan_drive_info + pos, " total %d chars\n", pos);
  535. if (ctl)
  536. if (ctl->procname)
  537. pos += sprintf(arlan_drive_info + pos, " driver name : %s\n", ctl->procname);
  538. final:
  539. *lenp = pos;
  540. if (!write)
  541. retv = proc_dostring(ctl, write, filp, buffer, lenp, ppos);
  542. else
  543. {
  544. *lenp = 0;
  545. return -1;
  546. }
  547. return retv;
  548. }
  549. static int arlan_sysctl_info161719(ctl_table * ctl, int write, struct file *filp,
  550. void __user *buffer, size_t * lenp, loff_t *ppos)
  551. {
  552. int i;
  553. int retv, pos, devnum;
  554. struct arlan_private *priva = NULL;
  555. pos = 0;
  556. devnum = ctl->procname[5] - '0';
  557. if (arlan_device[devnum] == NULL)
  558. {
  559. pos += sprintf(arlan_drive_info + pos, "No device found here \n");
  560. goto final;
  561. }
  562. else
  563. priva = arlan_device[devnum]->priv;
  564. if (priva == NULL)
  565. {
  566. printk(KERN_WARNING " Could not find the device private in arlan procsys, bad\n ");
  567. return -1;
  568. }
  569. memcpy_fromio(priva->conf, priva->card, sizeof(struct arlan_shmem));
  570. SARLUCN(_16, 0xC0);
  571. SARLUCN(_17, 0x6A);
  572. SARLUCN(_18, 14);
  573. SARLUCN(_19, 0x86);
  574. SARLUCN(_21, 0x3fd);
  575. final:
  576. *lenp = pos;
  577. retv = proc_dostring(ctl, write, filp, buffer, lenp, ppos);
  578. return retv;
  579. }
  580. static int arlan_sysctl_infotxRing(ctl_table * ctl, int write, struct file *filp,
  581. void __user *buffer, size_t * lenp, loff_t *ppos)
  582. {
  583. int i;
  584. int retv, pos, devnum;
  585. struct arlan_private *priva = NULL;
  586. pos = 0;
  587. devnum = ctl->procname[5] - '0';
  588. if (arlan_device[devnum] == NULL)
  589. {
  590. pos += sprintf(arlan_drive_info + pos, "No device found here \n");
  591. goto final;
  592. }
  593. else
  594. priva = arlan_device[devnum]->priv;
  595. if (priva == NULL)
  596. {
  597. printk(KERN_WARNING " Could not find the device private in arlan procsys, bad\n ");
  598. return -1;
  599. }
  600. memcpy_fromio(priva->conf, priva->card, sizeof(struct arlan_shmem));
  601. SARLBNpln(u_char, txBuffer, 0x800);
  602. final:
  603. *lenp = pos;
  604. retv = proc_dostring(ctl, write, filp, buffer, lenp, ppos);
  605. return retv;
  606. }
  607. static int arlan_sysctl_inforxRing(ctl_table * ctl, int write, struct file *filp,
  608. void __user *buffer, size_t * lenp, loff_t *ppos)
  609. {
  610. int i;
  611. int retv, pos, devnum;
  612. struct arlan_private *priva = NULL;
  613. pos = 0;
  614. devnum = ctl->procname[5] - '0';
  615. if (arlan_device[devnum] == NULL)
  616. {
  617. pos += sprintf(arlan_drive_info + pos, "No device found here \n");
  618. goto final;
  619. } else
  620. priva = arlan_device[devnum]->priv;
  621. if (priva == NULL)
  622. {
  623. printk(KERN_WARNING " Could not find the device private in arlan procsys, bad\n ");
  624. return -1;
  625. }
  626. memcpy_fromio(priva->conf, priva->card, sizeof(struct arlan_shmem));
  627. SARLBNpln(u_char, rxBuffer, 0x800);
  628. final:
  629. *lenp = pos;
  630. retv = proc_dostring(ctl, write, filp, buffer, lenp, ppos);
  631. return retv;
  632. }
  633. static int arlan_sysctl_info18(ctl_table * ctl, int write, struct file *filp,
  634. void __user *buffer, size_t * lenp, loff_t *ppos)
  635. {
  636. int i;
  637. int retv, pos, devnum;
  638. struct arlan_private *priva = NULL;
  639. pos = 0;
  640. devnum = ctl->procname[5] - '0';
  641. if (arlan_device[devnum] == NULL)
  642. {
  643. pos += sprintf(arlan_drive_info + pos, "No device found here \n");
  644. goto final;
  645. }
  646. else
  647. priva = arlan_device[devnum]->priv;
  648. if (priva == NULL)
  649. {
  650. printk(KERN_WARNING " Could not find the device private in arlan procsys, bad\n ");
  651. return -1;
  652. }
  653. memcpy_fromio(priva->conf, priva->card, sizeof(struct arlan_shmem));
  654. SARLBNpln(u_char, _18, 0x800);
  655. final:
  656. *lenp = pos;
  657. retv = proc_dostring(ctl, write, filp, buffer, lenp, ppos);
  658. return retv;
  659. }
  660. #endif /* #ifdef ARLAN_PROC_SHM_DUMP */
  661. static char conf_reset_result[200];
  662. static int arlan_configure(ctl_table * ctl, int write, struct file *filp,
  663. void __user *buffer, size_t * lenp, loff_t *ppos)
  664. {
  665. int pos = 0;
  666. int devnum = ctl->procname[6] - '0';
  667. struct arlan_private *priv;
  668. if (devnum < 0 || devnum > MAX_ARLANS - 1)
  669. {
  670. printk(KERN_WARNING "too strange devnum in procfs parse\n ");
  671. return -1;
  672. }
  673. else if (arlan_device[devnum] != NULL)
  674. {
  675. priv = arlan_device[devnum]->priv;
  676. arlan_command(arlan_device[devnum], ARLAN_COMMAND_CLEAN_AND_CONF);
  677. }
  678. else
  679. return -1;
  680. *lenp = pos;
  681. return proc_dostring(ctl, write, filp, buffer, lenp, ppos);
  682. }
  683. static int arlan_sysctl_reset(ctl_table * ctl, int write, struct file *filp,
  684. void __user *buffer, size_t * lenp, loff_t *ppos)
  685. {
  686. int pos = 0;
  687. int devnum = ctl->procname[5] - '0';
  688. struct arlan_private *priv;
  689. if (devnum < 0 || devnum > MAX_ARLANS - 1)
  690. {
  691. printk(KERN_WARNING "too strange devnum in procfs parse\n ");
  692. return -1;
  693. }
  694. else if (arlan_device[devnum] != NULL)
  695. {
  696. priv = arlan_device[devnum]->priv;
  697. arlan_command(arlan_device[devnum], ARLAN_COMMAND_CLEAN_AND_RESET);
  698. } else
  699. return -1;
  700. *lenp = pos + 3;
  701. return proc_dostring(ctl, write, filp, buffer, lenp, ppos);
  702. }
  703. /* Place files in /proc/sys/dev/arlan */
  704. #define CTBLN(num,card,nam) \
  705. { .ctl_name = num,\
  706. .procname = #nam,\
  707. .data = &(arlan_conf[card].nam),\
  708. .maxlen = sizeof(int), .mode = 0600, .proc_handler = &proc_dointvec}
  709. #ifdef ARLAN_DEBUGGING
  710. #define ARLAN_PROC_DEBUG_ENTRIES \
  711. { .ctl_name = 48, .procname = "entry_exit_debug",\
  712. .data = &arlan_entry_and_exit_debug,\
  713. .maxlen = sizeof(int), .mode = 0600, .proc_handler = &proc_dointvec},\
  714. { .ctl_name = 49, .procname = "debug", .data = &arlan_debug,\
  715. .maxlen = sizeof(int), .mode = 0600, .proc_handler = &proc_dointvec},
  716. #else
  717. #define ARLAN_PROC_DEBUG_ENTRIES
  718. #endif
  719. #define ARLAN_SYSCTL_TABLE_TOTAL(cardNo)\
  720. CTBLN(1,cardNo,spreadingCode),\
  721. CTBLN(2,cardNo, channelNumber),\
  722. CTBLN(3,cardNo, scramblingDisable),\
  723. CTBLN(4,cardNo, txAttenuation),\
  724. CTBLN(5,cardNo, systemId), \
  725. CTBLN(6,cardNo, maxDatagramSize),\
  726. CTBLN(7,cardNo, maxFrameSize),\
  727. CTBLN(8,cardNo, maxRetries),\
  728. CTBLN(9,cardNo, receiveMode),\
  729. CTBLN(10,cardNo, priority),\
  730. CTBLN(11,cardNo, rootOrRepeater),\
  731. CTBLN(12,cardNo, SID),\
  732. CTBLN(13,cardNo, registrationMode),\
  733. CTBLN(14,cardNo, registrationFill),\
  734. CTBLN(15,cardNo, localTalkAddress),\
  735. CTBLN(16,cardNo, codeFormat),\
  736. CTBLN(17,cardNo, numChannels),\
  737. CTBLN(18,cardNo, channel1),\
  738. CTBLN(19,cardNo, channel2),\
  739. CTBLN(20,cardNo, channel3),\
  740. CTBLN(21,cardNo, channel4),\
  741. CTBLN(22,cardNo, txClear),\
  742. CTBLN(23,cardNo, txRetries),\
  743. CTBLN(24,cardNo, txRouting),\
  744. CTBLN(25,cardNo, txScrambled),\
  745. CTBLN(26,cardNo, rxParameter),\
  746. CTBLN(27,cardNo, txTimeoutMs),\
  747. CTBLN(28,cardNo, waitCardTimeout),\
  748. CTBLN(29,cardNo, channelSet), \
  749. {.ctl_name = 30, .procname = "name",\
  750. .data = arlan_conf[cardNo].siteName,\
  751. .maxlen = 16, .mode = 0600, .proc_handler = &proc_dostring},\
  752. CTBLN(31,cardNo,waitTime),\
  753. CTBLN(32,cardNo,lParameter),\
  754. CTBLN(33,cardNo,_15),\
  755. CTBLN(34,cardNo,headerSize),\
  756. CTBLN(36,cardNo,tx_delay_ms),\
  757. CTBLN(37,cardNo,retries),\
  758. CTBLN(38,cardNo,ReTransmitPacketMaxSize),\
  759. CTBLN(39,cardNo,waitReTransmitPacketMaxSize),\
  760. CTBLN(40,cardNo,fastReTransCount),\
  761. CTBLN(41,cardNo,driverRetransmissions),\
  762. CTBLN(42,cardNo,txAckTimeoutMs),\
  763. CTBLN(43,cardNo,registrationInterrupts),\
  764. CTBLN(44,cardNo,hardwareType),\
  765. CTBLN(45,cardNo,radioType),\
  766. CTBLN(46,cardNo,writeEEPROM),\
  767. CTBLN(47,cardNo,writeRadioType),\
  768. ARLAN_PROC_DEBUG_ENTRIES\
  769. CTBLN(50,cardNo,in_speed),\
  770. CTBLN(51,cardNo,out_speed),\
  771. CTBLN(52,cardNo,in_speed10),\
  772. CTBLN(53,cardNo,out_speed10),\
  773. CTBLN(54,cardNo,in_speed_max),\
  774. CTBLN(55,cardNo,out_speed_max),\
  775. CTBLN(56,cardNo,measure_rate),\
  776. CTBLN(57,cardNo,pre_Command_Wait),\
  777. CTBLN(58,cardNo,rx_tweak1),\
  778. CTBLN(59,cardNo,rx_tweak2),\
  779. CTBLN(60,cardNo,tx_queue_len),\
  780. static ctl_table arlan_conf_table0[] =
  781. {
  782. ARLAN_SYSCTL_TABLE_TOTAL(0)
  783. #ifdef ARLAN_PROC_SHM_DUMP
  784. {
  785. .ctl_name = 150,
  786. .procname = "arlan0-txRing",
  787. .data = &arlan_drive_info,
  788. .maxlen = ARLAN_STR_SIZE,
  789. .mode = 0400,
  790. .proc_handler = &arlan_sysctl_infotxRing,
  791. },
  792. {
  793. .ctl_name = 151,
  794. .procname = "arlan0-rxRing",
  795. .data = &arlan_drive_info,
  796. .maxlen = ARLAN_STR_SIZE,
  797. .mode = 0400,
  798. .proc_handler = &arlan_sysctl_inforxRing,
  799. },
  800. {
  801. .ctl_name = 152,
  802. .procname = "arlan0-18",
  803. .data = &arlan_drive_info,
  804. .maxlen = ARLAN_STR_SIZE,
  805. .mode = 0400,
  806. .proc_handler = &arlan_sysctl_info18,
  807. },
  808. {
  809. .ctl_name = 153,
  810. .procname = "arlan0-ring",
  811. .data = &arlan_drive_info,
  812. .maxlen = ARLAN_STR_SIZE,
  813. .mode = 0400,
  814. .proc_handler = &arlan_sysctl_info161719,
  815. },
  816. {
  817. .ctl_name = 154,
  818. .procname = "arlan0-shm-cpy",
  819. .data = &arlan_drive_info,
  820. .maxlen = ARLAN_STR_SIZE,
  821. .mode = 0400,
  822. .proc_handler = &arlan_sysctl_info,
  823. },
  824. #endif
  825. {
  826. .ctl_name = 155,
  827. .procname = "config0",
  828. .data = &conf_reset_result,
  829. .maxlen = 100,
  830. .mode = 0400,
  831. .proc_handler = &arlan_configure
  832. },
  833. {
  834. .ctl_name = 156,
  835. .procname = "reset0",
  836. .data = &conf_reset_result,
  837. .maxlen = 100,
  838. .mode = 0400,
  839. .proc_handler = &arlan_sysctl_reset,
  840. },
  841. { .ctl_name = 0 }
  842. };
  843. static ctl_table arlan_conf_table1[] =
  844. {
  845. ARLAN_SYSCTL_TABLE_TOTAL(1)
  846. #ifdef ARLAN_PROC_SHM_DUMP
  847. {
  848. .ctl_name = 150,
  849. .procname = "arlan1-txRing",
  850. .data = &arlan_drive_info,
  851. .maxlen = ARLAN_STR_SIZE,
  852. .mode = 0400,
  853. .proc_handler = &arlan_sysctl_infotxRing,
  854. },
  855. {
  856. .ctl_name = 151,
  857. .procname = "arlan1-rxRing",
  858. .data = &arlan_drive_info,
  859. .maxlen = ARLAN_STR_SIZE,
  860. .mode = 0400,
  861. .proc_handler = &arlan_sysctl_inforxRing,
  862. },
  863. {
  864. .ctl_name = 152,
  865. .procname = "arlan1-18",
  866. .data = &arlan_drive_info,
  867. .maxlen = ARLAN_STR_SIZE,
  868. .mode = 0400,
  869. .proc_handler = &arlan_sysctl_info18,
  870. },
  871. {
  872. .ctl_name = 153,
  873. .procname = "arlan1-ring",
  874. .data = &arlan_drive_info,
  875. .maxlen = ARLAN_STR_SIZE,
  876. .mode = 0400,
  877. .proc_handler = &arlan_sysctl_info161719,
  878. },
  879. {
  880. .ctl_name = 154,
  881. .procname = "arlan1-shm-cpy",
  882. .data = &arlan_drive_info,
  883. .maxlen = ARLAN_STR_SIZE,
  884. .mode = 0400,
  885. .proc_handler = &arlan_sysctl_info,
  886. },
  887. #endif
  888. {
  889. .ctl_name = 155,
  890. .procname = "config1",
  891. .data = &conf_reset_result,
  892. .maxlen = 100,
  893. .mode = 0400,
  894. .proc_handler = &arlan_configure,
  895. },
  896. {
  897. .ctl_name = 156,
  898. .procname = "reset1",
  899. .data = &conf_reset_result,
  900. .maxlen = 100,
  901. .mode = 0400,
  902. .proc_handler = &arlan_sysctl_reset,
  903. },
  904. { .ctl_name = 0 }
  905. };
  906. static ctl_table arlan_conf_table2[] =
  907. {
  908. ARLAN_SYSCTL_TABLE_TOTAL(2)
  909. #ifdef ARLAN_PROC_SHM_DUMP
  910. {
  911. .ctl_name = 150,
  912. .procname = "arlan2-txRing",
  913. .data = &arlan_drive_info,
  914. .maxlen = ARLAN_STR_SIZE,
  915. .mode = 0400,
  916. .proc_handler = &arlan_sysctl_infotxRing,
  917. },
  918. {
  919. .ctl_name = 151,
  920. .procname = "arlan2-rxRing",
  921. .data = &arlan_drive_info,
  922. .maxlen = ARLAN_STR_SIZE,
  923. .mode = 0400,
  924. .proc_handler = &arlan_sysctl_inforxRing,
  925. },
  926. {
  927. .ctl_name = 152,
  928. .procname = "arlan2-18",
  929. .data = &arlan_drive_info,
  930. .maxlen = ARLAN_STR_SIZE,
  931. .mode = 0400,
  932. .proc_handler = &arlan_sysctl_info18,
  933. },
  934. {
  935. .ctl_name = 153,
  936. .procname = "arlan2-ring",
  937. .data = &arlan_drive_info,
  938. .maxlen = ARLAN_STR_SIZE,
  939. .mode = 0400,
  940. .proc_handler = &arlan_sysctl_info161719,
  941. },
  942. {
  943. .ctl_name = 154,
  944. .procname = "arlan2-shm-cpy",
  945. .data = &arlan_drive_info,
  946. .maxlen = ARLAN_STR_SIZE,
  947. .mode = 0400,
  948. .proc_handler = &arlan_sysctl_info,
  949. },
  950. #endif
  951. {
  952. .ctl_name = 155,
  953. .procname = "config2",
  954. .data = &conf_reset_result,
  955. .maxlen = 100,
  956. .mode = 0400,
  957. .proc_handler = &arlan_configure,
  958. },
  959. {
  960. .ctl_name = 156,
  961. .procname = "reset2",
  962. .data = &conf_reset_result,
  963. .maxlen = 100,
  964. .mode = 0400,
  965. .proc_handler = &arlan_sysctl_reset,
  966. },
  967. { .ctl_name = 0 }
  968. };
  969. static ctl_table arlan_conf_table3[] =
  970. {
  971. ARLAN_SYSCTL_TABLE_TOTAL(3)
  972. #ifdef ARLAN_PROC_SHM_DUMP
  973. {
  974. .ctl_name = 150,
  975. .procname = "arlan3-txRing",
  976. .data = &arlan_drive_info,
  977. .maxlen = ARLAN_STR_SIZE,
  978. .mode = 0400,
  979. .proc_handler = &arlan_sysctl_infotxRing,
  980. },
  981. {
  982. .ctl_name = 151,
  983. .procname = "arlan3-rxRing",
  984. .data = &arlan_drive_info,
  985. .maxlen = ARLAN_STR_SIZE,
  986. .mode = 0400,
  987. .proc_handler = &arlan_sysctl_inforxRing,
  988. },
  989. {
  990. .ctl_name = 152,
  991. .procname = "arlan3-18",
  992. .data = &arlan_drive_info,
  993. .maxlen = ARLAN_STR_SIZE,
  994. .mode = 0400,
  995. .proc_handler = &arlan_sysctl_info18,
  996. },
  997. {
  998. .ctl_name = 153,
  999. .procname = "arlan3-ring",
  1000. .data = &arlan_drive_info,
  1001. .maxlen = ARLAN_STR_SIZE,
  1002. .mode = 0400,
  1003. .proc_handler = &arlan_sysctl_info161719,
  1004. },
  1005. {
  1006. .ctl_name = 154,
  1007. .procname = "arlan3-shm-cpy",
  1008. .data = &arlan_drive_info,
  1009. .maxlen = ARLAN_STR_SIZE,
  1010. .mode = 0400,
  1011. .proc_handler = &arlan_sysctl_info,
  1012. },
  1013. #endif
  1014. {
  1015. .ctl_name = 155,
  1016. .procname = "config3",
  1017. .data = &conf_reset_result,
  1018. .maxlen = 100,
  1019. .mode = 0400,
  1020. .proc_handler = &arlan_configure,
  1021. },
  1022. {
  1023. .ctl_name = 156,
  1024. .procname = "reset3",
  1025. .data = &conf_reset_result,
  1026. .maxlen = 100,
  1027. .mode = 0400,
  1028. .proc_handler = &arlan_sysctl_reset,
  1029. },
  1030. { .ctl_name = 0 }
  1031. };
  1032. static ctl_table arlan_table[] =
  1033. {
  1034. {
  1035. .ctl_name = 0,
  1036. .procname = "arlan0",
  1037. .maxlen = 0,
  1038. .mode = 0600,
  1039. .child = arlan_conf_table0,
  1040. },
  1041. {
  1042. .ctl_name = 0,
  1043. .procname = "arlan1",
  1044. .maxlen = 0,
  1045. .mode = 0600,
  1046. .child = arlan_conf_table1,
  1047. },
  1048. {
  1049. .ctl_name = 0,
  1050. .procname = "arlan2",
  1051. .maxlen = 0,
  1052. .mode = 0600,
  1053. .child = arlan_conf_table2,
  1054. },
  1055. {
  1056. .ctl_name = 0,
  1057. .procname = "arlan3",
  1058. .maxlen = 0,
  1059. .mode = 0600,
  1060. .child = arlan_conf_table3,
  1061. },
  1062. { .ctl_name = 0 }
  1063. };
  1064. #else
  1065. static ctl_table arlan_table[MAX_ARLANS + 1] =
  1066. {
  1067. { .ctl_name = 0 }
  1068. };
  1069. #endif
  1070. #else
  1071. static ctl_table arlan_table[MAX_ARLANS + 1] =
  1072. {
  1073. { .ctl_name = 0 }
  1074. };
  1075. #endif
  1076. // static int mmtu = 1234;
  1077. static ctl_table arlan_root_table[] =
  1078. {
  1079. {
  1080. .ctl_name = CTL_ARLAN,
  1081. .procname = "arlan",
  1082. .maxlen = 0,
  1083. .mode = 0555,
  1084. .child = arlan_table,
  1085. },
  1086. { .ctl_name = 0 }
  1087. };
  1088. /* Make sure that /proc/sys/dev is there */
  1089. //static ctl_table arlan_device_root_table[] =
  1090. //{
  1091. // {CTL_DEV, "dev", NULL, 0, 0555, arlan_root_table},
  1092. // {0}
  1093. //};
  1094. #ifdef CONFIG_PROC_FS
  1095. static struct ctl_table_header *arlan_device_sysctl_header;
  1096. int __init init_arlan_proc(void)
  1097. {
  1098. int i = 0;
  1099. if (arlan_device_sysctl_header)
  1100. return 0;
  1101. for (i = 0; i < MAX_ARLANS && arlan_device[i]; i++)
  1102. arlan_table[i].ctl_name = i + 1;
  1103. arlan_device_sysctl_header = register_sysctl_table(arlan_root_table);
  1104. if (!arlan_device_sysctl_header)
  1105. return -1;
  1106. return 0;
  1107. }
  1108. void __exit cleanup_arlan_proc(void)
  1109. {
  1110. unregister_sysctl_table(arlan_device_sysctl_header);
  1111. arlan_device_sysctl_header = NULL;
  1112. }
  1113. #endif