arlan-proc.c 29 KB

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