这些小活动你都参加了吗?快来围观一下吧!>>
电子产品世界 » 论坛首页 » 综合技术 » 基础知识 » 8019,ARP,UDP,ICMP,TCP 怪!我的8019驱动为什么能收ARP

共2条 1/1 1 跳转至

8019,ARP,UDP,ICMP,TCP 怪!我的8019驱动为什么能收ARP,UDP包,却收不到ICMP TCP呢?

院士
2006-09-17 18:14:16     打赏
8019,ARP,UDP,ICMP,TCP 怪!我的8019驱动为什么能收ARP,UDP包,却收不到ICMP TCP呢?



关键词: 我的     驱动     为什么     能收     却收     不到    

院士
2006-12-22 22:43:00     打赏
2楼
问 在44b0+ucos下做lwip的移植,问题多多啊!

   我也不知道怎么搞得,奇怪了,我的8019驱动为什么能收ARP,UDP包,却收不到ICMPTCP包!!
   ARP已经通了,而中断对icmp (ping)和tcp (telnet)却不理??我是用Ethereal抓的包。
   各位碰到没有,帮我想想问题出在那儿了!!多谢!!


    1: 同样是数据包,差距咋这么大呢!!即然能正确接收ARP UDP包,说明我的8019驱动应该是好的吧?怎么会有这种问题???

ping 172.16.4.15     这个ip不存在,发4个ARP包,都能接收并处理;
ping 17727           17727 当作主机名,发3个NBNS包,nbns是udp,能收到;
ping 172.16.4.18     8019 的ip,发4个ICMP包,网卡根本不中断;
telnet 172.16.4.18 7  发3个TCP包,没反应:(

?????????????????????????
兄弟们帮忙分析一下,想不通啊!!多谢
2: 把驱动源代码贴出,这样才好帮你改,这样说鬼知道是什么问题 3: 应该是软件问题,好好找找。 4: 是skyeye 杨晔的驱动驱动太长了,能把人看晕的

下面是8019中断的代码,我就在这里设断点,ARP UCP包能中断,而icmp和tcp就停不下来。????

void __irq  ne2k_isr(void)
{
    u8_t  isr,curr,bnry;
    struct netif *netif;
    rI_ISPC =BIT_EINT1;
    //close nic
    //******************** add by maokor for debug ,2005.6.17*******
    outb(CMD_PAGE2 | CMD_NODMA | CMD_STOP,NE_CR);
    isr = inb(NE_IMR);
    //*****************************************************888888
    //in PAGE0
    outb(CMD_PAGE0 | CMD_NODMA | CMD_STOP,NE_CR);
    isr = inb(NE_ISR);

    // ram overflow interrupt
    if (isr & ISR_OVW) {
        outb(ISR_OVW,NE_ISR);        // clear interrupt
    //    ne2k_overflowProcess();              //yangye :no overflow now
    }
    
    // error transfer interrupt ,NIC abort tx due to excessive collisions    
    if (isr & ISR_TXE) {
        outb(ISR_TXE,NE_ISR);        // clear interrupt
         //temporarily do nothing
    }

    // Rx error , reset BNRY pointer to CURR (use SEND PACKET mode)
    if (isr & ISR_RXE) {
        outb(ISR_RXE,NE_ISR);        // clear interrupt
        
        outb(CMD_PAGE1 | CMD_NODMA | CMD_STOP,NE_CR);
        curr = inb(NE_CURR);
        outb(CMD_PAGE0 | CMD_NODMA | CMD_STOP,NE_CR);
        outb(curr, NE_BNRY);
    }
    
    //got packet with no errors
    if (isr & ISR_PRX) {
        outb(ISR_PRX, NE_ISR);        // clear interrupt

        outb(CMD_PAGE1 | CMD_NODMA | CMD_STOP, NE_CR);
        curr  =  inb(NE_CURR);
        outb(CMD_PAGE0 | CMD_NODMA | CMD_STOP, NE_CR);
        bnry = inb(NE_BNRY);
        //yangye 2003-1-21
        //get more than one packet until receive buffer is empty
        while(curr != bnry){
            ne2k_recv_packet(rtl8019if_netif);
            outb(CMD_PAGE1 | CMD_NODMA | CMD_STOP, NE_CR);
            curr =  inb(NE_CURR);
            outb(CMD_PAGE0 | CMD_NODMA | CMD_STOP, NE_CR);
            bnry =     inb(NE_BNRY);            
            }
    }
        
    //Transfer complelte, do nothing here
    if( isr & ISR_PTX){
        PRINT("ne2k_isr: is ISR_PTX\n");
        outb(ISR_PTX, NE_ISR);          // clear interrupt
    }
        
    outb(CMD_PAGE0 | CMD_NODMA | CMD_STOP, NE_CR);
    outb(0xff, NE_ISR);            // clear ISR    
    //open nic for next packet
    outb(CMD_PAGE0 | CMD_NODMA | CMD_RUN, NE_CR);

}
5: 8019 有bug,千万要注意可以参考linux下的驱动,那个是修正bug的,千万不要用没有经过实践验证的代码。 6: 啊!多谢各位回复!
wangkj:8019有bug?能具体说说吗,skyeye的驱动好像也有人移植成功过! 7: 可能是mac地址不对我对比了一下,发现这几种包的区别是目的mac不同,arp是广播的就能受到。难道是网卡的mac设置不对?

8019发送的arp回复包中的mac地址是直接读寄存器的还是程序设置的?怎么会错呢?

我把arp包贴出来,兄弟们帮我分析一下,另外这个包有校验错误(incorrect, should be 0xaf8108fa)不知哪里错了?


No.     Time        Source                Destination           Protocol Info
     65 1436.867353 25:01:00:ea:5d:00     172.16.4.10           ARP      172.16.4.18 is at 25:01:00:ea:5d:00

Frame 65 (64 bytes on wire, 64 bytes captured)
Ethernet II, Src: 25:01:00:ea:5d:00, Dst: 00:05:5d:02:14:db
    Destination: 00:05:5d:02:14:db (172.16.4.10)
    Source: 25:01:00:ea:5d:00 (25:01:00:ea:5d:00)
    Type: ARP (0x0806)
    Trailer: 000000000000000000000000000000000000
    Frame check sequence: 0xc4be25b7 (incorrect, should be 0xaf8108fa)
Address Resolution Protocol (reply)
    Hardware type: Ethernet (0x0001)
    Protocol type: IP (0x0800)
    Hardware size: 6
    Protocol size: 4
    Opcode: reply (0x0002)
    Sender MAC address: 25:01:00:ea:5d:00 (25:01:00:ea:5d:00)
    Sender IP address: 172.16.4.18 (172.16.4.18)
    Target MAC address: 00:05:5d:02:14:db (172.16.4.10)
    Target IP address: 172.16.4.10 (172.16.4.10)
8: 发现mac地址没有正确保存,才错误发现个问题,帮我看看!
struct RTL8019if {
  struct eth_addr *ethaddr;
  };

packed struct eth_addr {
  u8_t addr[6];
} PACK_STRUCT_STRUCT;


static void
low_level_init(struct netif * netif)
{
    u8_t i, isr;
    struct RTL8019if *rtl8019if,rtl8019;
    u8_t mac_addr[6];
        mac_addr[0]=inb(NE_PAR0);
        mac_addr[1]=inb(NE_PAR1);
        mac_addr[2]=inb(NE_PAR2);
        mac_addr[3]=inb(NE_PAR3);
        mac_addr[4]=inb(NE_PAR4);
        mac_addr[5]=inb(NE_PAR5);
      /* make up an address. */
      rtl8019if->ethaddr->addr[0] = mac_addr[0];
      rtl8019if->ethaddr->addr[1] = mac_addr[1];
      rtl8019if->ethaddr->addr[2] = mac_addr[2];
      rtl8019if->ethaddr->addr[3] = mac_addr[3];
      rtl8019if->ethaddr->addr[4] = mac_addr[4];
      rtl8019if->ethaddr->addr[5] = mac_addr[5];
    
    
    rtl8019=*rtl8019if;

mac_addr数组读值正确 ,但是 赋值给rtl8019if->ethaddr->addr时没有成功,sdt中查看变量rtl8019值,只能看到->ethaddr是0x00000000。是数据结构packed的问题吗?多谢!

共2条 1/1 1 跳转至

回复

匿名不能发帖!请先 [ 登陆 注册 ]