arlan-proc.c 29 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253
  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 = netdev_priv(arlan_device[devnum]);
  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 = netdev_priv(arlan_device[devnum]);
  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 = netdev_priv(arlan_device[devnum]);
  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 = netdev_priv(arlan_device[devnum]);
  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 = netdev_priv(arlan_device[devnum]);
  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 = netdev_priv(arlan_device[devnum]);
  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 = netdev_priv(arlan_device[devnum]);
  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. // static int mmtu = 1234;
  1071. static ctl_table arlan_root_table[] =
  1072. {
  1073. {
  1074. .ctl_name = CTL_ARLAN,
  1075. .procname = "arlan",
  1076. .maxlen = 0,
  1077. .mode = 0555,
  1078. .child = arlan_table,
  1079. },
  1080. { .ctl_name = 0 }
  1081. };
  1082. /* Make sure that /proc/sys/dev is there */
  1083. //static ctl_table arlan_device_root_table[] =
  1084. //{
  1085. // {CTL_DEV, "dev", NULL, 0, 0555, arlan_root_table},
  1086. // {0}
  1087. //};
  1088. static struct ctl_table_header *arlan_device_sysctl_header;
  1089. int __init init_arlan_proc(void)
  1090. {
  1091. int i = 0;
  1092. if (arlan_device_sysctl_header)
  1093. return 0;
  1094. for (i = 0; i < MAX_ARLANS && arlan_device[i]; i++)
  1095. arlan_table[i].ctl_name = i + 1;
  1096. arlan_device_sysctl_header = register_sysctl_table(arlan_root_table);
  1097. if (!arlan_device_sysctl_header)
  1098. return -1;
  1099. return 0;
  1100. }
  1101. void __exit cleanup_arlan_proc(void)
  1102. {
  1103. unregister_sysctl_table(arlan_device_sysctl_header);
  1104. arlan_device_sysctl_header = NULL;
  1105. }
  1106. #endif