LinuxÄÚºËNAPI»úÖÆ·ÖÎö
NAPI ÊÇ Linux ÉϲÉÓõÄÒ»ÖÖÌá¸ßÍøÂç´¦ÀíЧÂʵļ¼Êõ£¬ËüµÄºËÐĸÅÄî¾ÍÊDz»²ÉÓÃÖжϵķ½Ê½¶ÁÈ¡Êý¾Ý£¬¶ø´úÖ®ÒÔÊ×ÏȲÉÓÃÖжϻ½ÐÑÊý¾Ý½ÓÊյķþÎñ³ÌÐò£¬È»ºó POLL µÄ·½·¨À´ÂÖѯÊý¾Ý¡£Ëæ×ÅÍøÂçµÄ½ÓÊÕËٶȵÄÔö¼Ó£¬NIC ´¥·¢µÄÖжÏÄÜ×öµ½²»¶Ï¼õÉÙ£¬Ä¿Ç° NAPI ¼¼ÊõÒѾÔÚÍø¿¨Çý¶¯²ãºÍÍøÂç²ãµÃµ½Á˹㷺µÄÓ¦Óã¬Çý¶¯²ã´ÎÉÏÒѾÓÐ E1000 ϵÁÐÍø¿¨£¬RTL8139 ϵÁÐÍø¿¨£¬3c50X ϵÁеÈÖ÷Á÷µÄÍøÂçÊÊÅäÆ÷¶¼²ÉÓÃÁËÕâ¸ö¼¼Êõ£¬¶øÔÚÍøÂç²ã´ÎÉÏ£¬NAPI ¼¼ÊõÒѾÍêÈ«±»Ó¦Óõ½ÁËÖøÃûµÄ netif_rx º¯ÊýÖм䣬²¢ÇÒÌṩÁËרÃÅµÄ POLL ·½·¨--process_backlog À´´¦ÀíÂÖѯµÄ·½·¨£»¸ù¾ÝʵÑéÊý¾Ý±íÃ÷²ÉÓÃNAPI¼¼Êõ¿ÉÒÔ´ó´ó¸ÄÉƶ̳¤¶ÈÊý¾Ý°ü½ÓÊÕµÄЧÂÊ£¬¼õÉÙÖжϴ¥·¢µÄʱ¼ä¡£
µ«ÊÇ NAPI ´æÔÚһЩ±È½ÏÑÏÖصÄȱÏÝ£º
1£® ¶ÔÓÚÉϲãµÄÓ¦ÓóÌÐò¶øÑÔ£¬ÏµÍ³²»ÄÜÔÚÿ¸öÊý¾Ý°ü½ÓÊÕµ½µÄʱºò¶¼¿ÉÒÔ¼°Ê±µØÈ¥´¦ÀíËü£¬¶øÇÒËæ×Å´«ÊäËÙ¶ÈÔö¼Ó£¬ÀۼƵÄÊý¾Ý°ü½«»áºÄ·Ñ´óÁ¿µÄÄڴ棬¾¹ýʵÑé±íÃ÷ÔÚ Linux ƽ̨ÉÏÕâ¸öÎÊÌâ»á±ÈÔÚ FreeBSD ÉÏÒªÑÏÖØһЩ£»
2£® ÁíÍâÒ»¸öÎÊÌâÊǶÔÓÚ´óµÄÊý¾Ý°ü´¦Àí±È½ÏÀ§ÄÑ£¬ÔÒòÊÇ´óµÄÊý¾Ý°ü´«Ë͵½ÍøÂç²ãÉϵÄʱºòºÄ·ÑµÄʱ¼ä±È¶ÌÊý¾Ý°ü³¤ºÜ¶à£¨¼´Ê¹ÊDzÉÓà DMA ·½Ê½£©£¬ËùÒÔÕýÈçÇ°ÃæËù˵µÄÄÇÑù£¬NAPI ¼¼ÊõÊÊÓÃÓÚ¶Ô¸ßËÙÂʵĶ̳¤¶ÈÊý¾Ý°üµÄ´¦Àí¡£
ʹÓà NAPI ÏȾöÌõ¼þ£º
Çý¶¯¿ÉÒÔ¼ÌÐøʹÓÃÀ쵀 2.4 Äں˵ÄÍøÂçÇý¶¯³ÌÐò½Ó¿Ú£¬NAPI µÄ¼ÓÈë²¢²»»áµ¼ÖÂÏòÇ°¼æÈÝÐÔµÄɥʧ£¬µ«ÊÇ NAPI µÄʹÓÃÖÁÉÙÒªµÃµ½ÏÂÃæµÄ±£Ö¤£º
1. ҪʹÓà DMA µÄ»·ÐÎÊäÈë¶ÓÁУ¨Ò²¾ÍÊÇ ring_dma£¬Õâ¸öÔÚ 2.4 Çý¶¯ÖйØÓÚ Ethernet µÄ²¿·ÖÓÐÏêϸµÄ½éÉÜ£©£¬»òÕßÊÇÓÐ×ã¹»µÄÄÚ´æ¿Õ¼ä»º´æÇý¶¯»ñµÃµÄ°ü¡£
2. ÔÚ·¢ËÍ/½ÓÊÕÊý¾Ý°ü²úÉúÖжϵÄʱºòÓÐÄÜÁ¦¹Ø¶Ï NIC ÖжϵÄʼþ´¦Àí£¬²¢ÇÒÔÚ¹Ø¶Ï NIC ÒԺ󣬲¢²»Ó°ÏìÊý¾Ý°ü½ÓÊÕµ½ÍøÂçÉ豸µÄ»·Ðλº³åÇø£¨ÒÔϼò³Æ rx-ring£©´¦Àí¶ÓÁÐÖС£
NAPI ¶ÔÊý¾Ý°üµ½´ïµÄʼþµÄ´¦Àí²ÉÓÃÂÖѯ·½·¨£¬ÔÚÊý¾Ý°ü´ïµ½µÄʱºò£¬NAPI ¾Í»áÇ¿ÖÆÖ´ÐÐdev->poll ·½·¨¡£¶øºÍ²»ÏñÒÔÇ°µÄÇý¶¯ÄÇÑùΪÁ˼õÉÙ°üµ½´ïʱ¼äµÄ´¦ÀíÑÓ³Ù£¬Í¨³£²ÉÓÃÖжϵķ½·¨À´½øÐС£
E1000Íø¿¨Çý¶¯³ÌÐò¶ÔNAPIµÄÖ§³Ö£º
ÉÏÃæÒѾ½éÉܹýÁË£¬Ê¹ÓÃNAPIÐèÒªÔÚ±àÒëÄں˵ÄʱºòÑ¡
Ïà¹ØÎĵµ£º
Ò»¡¢ÒýÑÔ£º
±¾ÎĵµµÄÄÚÈݴ󲿷ÝÄÚÈݶ¼ÊÇ´ÓÍøÉÏÊÕ¼¯¶øÀ´£¬È»ºóÅäºÏһЩеĽØͼ£¨Äں˰汾£ºV2.4.19£©¡£ÔÚÿһÅäÖÃÏîºó»áÓÐÒ»¸öÑ¡ÔñÖ¸ÄϵIJ¿·Ý£¬ÓÃÀ´Ö¸µ¼´ó¼ÒÔõôÑù¸ù¾Ý×Ô¼ºµÄÇé¿öÀ´×öÏàÓ¦µÄÑ¡Ôñ£»»¹ÓÐÔÚÿһ¸ö´óÏîºÍÎĵµµÄ×îºó»áÓÐÒ»¸ö¾Ñé̸£¬ËüÊÇһЩ¸ßÊÖÃÇÔÚÓ¦¶ÔÎÊÌâºÍ´¦ÀíÌØÓÐÓ²¼þʱµÄһЩ¾Ñ飨Õâ¸ö»¹µ ......
Ò». Æô¶¯,¹Ø»ú,µÇÈë,µÇ³öÏà¹ØÃüÁî
<login> 怬
<logout> µÇ³ö
<exit> µÇ³ö
<shutdown> ֹͣϵͳ
<halt> ֹͣϵͳ
<reboot> ÖØÆô¶¯
<poweroff> ÇжϵçÔ´
<sync> °ÑÄÚ´æÀïµÄÄÚÈÝдÈë´ÅÅÌ
<lilo> °²×°liloÆô¶¯¹ÜÀí³ÌÐò
<grub> °²×°liloÆô¶¯¹ÜÀí³ÌÐò ......
Ò»¡¢±àÒëºÍÁ¬½Ó
Ò»°ãÀ´Ëµ£¬Èç¹û¿âµÄÍ·Îļþ²»ÔÚ /usr/include Ŀ¼ÖУ¬ÄÇôÔÚ±àÒëµÄʱºòÐèÒªÓà -I
²ÎÊýÖ¸¶¨Æä·¾¶¡£ÓÉÓÚͬһ¸ö¿âÔÚ²»Í¬ÏµÍ³ÉÏ¿ÉÄÜλÓÚ²»Í¬µÄĿ¼Ï£¬Óû§°²×°¿âµÄʱºòÒ²¿ÉÒÔ½«¿â°²×°ÔÚ²»Í¬µÄĿ¼Ï£¬ËùÒÔ¼´Ê¹Ê¹ÓÃͬһ¸ö¿â£¬ÓÉÓÚ¿âµÄ·¾¶µÄ
²»Í¬£¬Ôì³ÉÁËÓà -I ²ÎÊýÖ ......
²»À뿪EmacsÍê³É¼òµ¥C³ÌÐòµÄ±à¼±àÒëÔËÐУ¨×ª£©
£¨1£©´ò¿ªEmacs£¬Ö´ÐÐ
$ emacs
£¨2£©½¨Á¢Ò»¸öеijÌÐòÎļþ. Ö´ÐÐ C-x C-f£¬
È»ºóÔÚÆÁÄ»µÄµ×²¿³öÏÖminibuffer£¬¹â±êÌáʾÄãÊäÈëÎļþÃû³Æ£¬
ÎļþÃû³ÆÒª´øÉϺó׺Ãû£¬Èçhello.cpp¡£»Ø³µ£¬È»ºó¿ªÊ¼±à¼Ô´´úÂë¡£
£¨3£©±àÒë´úÂë¡£Ö´ÐÐEsc-x compile£¬³öÏÖminibuffer£¬ÌáʾÄãÊäÈ ......