From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17857 invoked by alias); 23 Oct 2007 08:27:35 -0000 Received: (qmail 17840 invoked by uid 22791); 23 Oct 2007 08:27:33 -0000 X-Spam-Check-By: sourceware.org Received: from mms3.broadcom.com (HELO MMS3.broadcom.com) (216.31.210.19) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 23 Oct 2007 08:27:29 +0000 Received: from [10.10.64.154] by MMS3.broadcom.com with ESMTP (Broadcom SMTP Relay (Email Firewall v6.3.1)); Tue, 23 Oct 2007 01:27:22 -0700 X-Server-Uuid: 20144BB6-FB76-4F11-80B6-E6B2900CA0D7 Received: by mail-irva-10.broadcom.com (Postfix, from userid 47) id 869502AF; Tue, 23 Oct 2007 01:27:22 -0700 (PDT) Received: from mail-irva-8.broadcom.com (mail-irva-8 [10.10.64.221]) by mail-irva-10.broadcom.com (Postfix) with ESMTP id 727612AE; Tue, 23 Oct 2007 01:27:22 -0700 (PDT) Received: from mail-sj1-12.sj.broadcom.com (mail-sj1-12.sj.broadcom.com [10.16.128.215]) by mail-irva-8.broadcom.com (MOS 3.7.5a-GA) with ESMTP id FVL10057; Tue, 23 Oct 2007 01:27:08 -0700 (PDT) Received: from NT-SJCA-0752.brcm.ad.broadcom.com (nt-sjca-0752 [10.16.192.222]) by mail-sj1-12.sj.broadcom.com (Postfix) with ESMTP id 2A6B720502; Tue, 23 Oct 2007 01:27:08 -0700 (PDT) Content-class: urn:content-classes:message MIME-Version: 1.0 Date: Tue, 23 Oct 2007 08:27:00 -0000 Message-ID: In-Reply-To: <000501c8154d$ecc04db0$1c0110ac@ariga> References: <000501c7f691$4847e2f0$1c0110ac@ariga> <20070914082224.GA16840@lunn.ch> <000501c80eef$edf10f30$1c0110ac@ariga> <47134CDD.1080604@mlbassoc.com> <004301c80fa1$3dcb15d0$1c0110ac@ariga> <47149BA6.1080500@mlbassoc.com> <001301c81091$1d11b060$1c0110ac@ariga> <4715F2D0.7080704@mlbassoc.com> <000c01c81151$9add59c0$1c0110ac@ariga> <47173F99.80405@mlbassoc.com> <000601c8120c$667aa3c0$1c0110ac@ariga> <47187EEB.5020109@mlbassoc.com> <000501c8154d$ecc04db0$1c0110ac@ariga> From: "Alok Singh" To: "ariga masahiro" cc: ecos-discuss@ecos.sourceware.org X-WSS-ID: 6B036FE04QC5557501-01-01 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact ecos-discuss-help@ecos.sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: ecos-discuss-owner@ecos.sourceware.org Subject: RE: [ECOS] What functions should I call in ethernet drv ? X-SW-Source: 2007-10/txt/msg00117.txt.bz2 Ariga, Can you send us the dump of IP packet also (not ARP) on your system? We wan= t to make sure that you are seeing the problem only with Arp packet. Send 6= 4 bytes starting with Ethernet header. -Alok -----Original Message----- From: ecos-discuss-owner@ecos.sourceware.org [mailto:ecos-discuss-owner@eco= s.sourceware.org] On Behalf Of ariga masahiro Sent: Tuesday, October 23, 2007 1:53 PM To: Gary Thomas Cc: ecos-discuss@ecos.sourceware.org Subject: Re: [ECOS] What functions should I call in ethernet drv ? Hello Gary and others, I have learned ARP operation. I've got "TCP/IP illustrated vol2" by W.Richard Stevens. I have traced to ARP interpreting point. First I breaked lan91cxx_recv() when received ARP packet, and next breaked if_ethersubr.c's ether_input(ifp, eh, m) function. And I traced into ether_demux(). ether_demux(ifp, eh, m) 594: switch (ether_type) { 595: #ifdef INET 596: case ETHERTYPE_IP: 597: if (ipflow_fastforward(m)) 598: return; 599: schednetisr(NETISR_IP); 600: inq =3D &ipintrq; 601: break; 602: 603: case ETHERTYPE_ARP: 604: if (ifp->if_flags & IFF_NOARP) { 605: /* Discard packet if ARP is disabled on interface */ 606: m_freem(m); 607: return; 608: } 609: schednetisr(NETISR_ARP); 610: inq =3D &arpintrq; 611: break; and I found ether_type=3D=3D0x0608,so couldn't recognize ARP. I concluded entering data in little Endian is wrong, so as a makeshift I amended source next. First I concocted get_data_byte(struct eth_drv_sc *sc) to get data exchangedly like I previously sent the coding. And I alse concocted in cyg_uint16 get_data_short like below to echange data. 1079: cyg_uint16 get_data_short(struct eth_drv_sc *sc) 1080: { 1081: cyg_uint16 val; 1082: 1083: val =3D get_data_byte(sc); 1084: //val |=3D get_data_byte(sc)<<8; val =3D val<<8 | get_data_byte(sc); --I concocted to rever= se=20 data. 1085: 1086: return CYG_LE16_TO_CPU(val); 1087: } I know it's bad coding but as I said this is a makeshift and I expect your best amended source.(on condition I was right) Anyway I could continue debugging. After that I confirmed that following interrrupt, it entered in if_ether.c's arpintr(). Then I traced into in_arpinput(m), and according to the book,here send ARP-reply. My expectancy reached high. But alas,in in_arpinput(m) didn't go to the point of sending packet. The reason was, in first part of coding, 529: in_arpinput(m) 530: struct mbuf *m; 531: { 532: register struct ether_arp *ea; 533: register struct arpcom *ac =3D (struct arpcom=20 *)m->m_pkthdr.rcvif; 534: struct ether_header *eh; 535: struct iso88025_header *th =3D (struct iso88025_header *)0; 536: register struct llinfo_arp *la =3D 0; 537: register struct rtentry *rt; 538: struct in_ifaddr *ia, *maybe_ia =3D 0; 539: struct sockaddr_dl *sdl; 540: struct sockaddr sa; 541: struct in_addr isaddr, itaddr, myaddr; 542: int op, rif_len; 543: 544: if (m->m_len < sizeof(struct ether_arp) && 545: (m =3D m_pullup(m, sizeof(struct ether_arp))) =3D=3D NU= LL) { 546: log(LOG_ERR, "in_arp: runt packet -- m_pullup=20 failed\n"); 547: return; 548: } 549: 550: ea =3D mtod(m, struct ether_arp *); 551: op =3D ntohs(ea->arp_op); 552: (void)memcpy(&isaddr, ea->arp_spa, sizeof (isaddr)); 553: (void)memcpy(&itaddr, ea->arp_tpa, sizeof (itaddr)); 554: for (ia =3D in_ifaddrhead.tqh_first; ia; ia =3D=20 ia->ia_link.tqe_next) { 555: /* 556: * For a bridge, we want to check the address=20 irrespective 557: * of the receive interface. (This will change slightly 558: * when we have clusters of interfaces). 559: */ 560: #ifdef BRIDGE 561: #define BRIDGE_TEST (do_bridge) 562: #else 563: #define BRIDGE_TEST (0) /* cc will optimise the test away */ 564: #endif 565: if ((BRIDGE_TEST) || (ia->ia_ifp =3D=3D &ac->ac_if)) { 566: maybe_ia =3D ia; 567: if ((itaddr.s_addr =3D=3D ia->ia_addr.sin_addr.s_ad= dr)=20 || 568: (isaddr.s_addr =3D=3D ia->ia_addr.sin_addr.s_a= ddr))=20 { 569: break; 570: } 571: } 572: } 573: if (maybe_ia =3D=3D 0) { 574: m_freem(m); 575: return; 576: } 577: myaddr =3D ia ? ia->ia_addr.sin_addr :=20 maybe_ia->ia_addr.sin_addr; --ia,=AA00 at 554 line,there was nothing in_ifaddrhead.tqh_first, and at 577, ia became 00000000. Here,Gary, I sincerely ask your opinion. The trouble is there is nothing in in_ifaddrhead.tqh_first, do you have any idea what caused this mishappening ? I expect your any hints whatever. Thanks in advance. Masahiro Ariga --=20 Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss -- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss