From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 61135 invoked by alias); 26 May 2015 08:15:59 -0000 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 Received: (qmail 61119 invoked by uid 89); 26 May 2015 08:15:58 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.2 required=5.0 tests=AWL,BAYES_40,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx3.zhaw.ch Received: from srv-mail-013.zhaw.ch (HELO mx3.zhaw.ch) (160.85.104.123) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 26 May 2015 08:15:48 +0000 Received: from mx3.zhaw.ch (localhost [127.0.0.1]) by localhost (Postfix) with SMTP id 624EFF5 for ; Tue, 26 May 2015 10:15:46 +0200 (CEST) Received: from [10.0.12.16] (clt-lab-t-6006.zhaw.ch [160.85.232.249]) by mx3.zhaw.ch (Postfix) with ESMTP id 307B6F1 for ; Tue, 26 May 2015 10:15:46 +0200 (CEST) Message-ID: <55642BB2.6080403@zhaw.ch> Date: Tue, 26 May 2015 08:15:00 -0000 From: lesc User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: ecos-discuss@ecos.sourceware.org References: <55642B08.4000502@zhaw.ch> In-Reply-To: <55642B08.4000502@zhaw.ch> X-Forwarded-Message-Id: <55642B08.4000502@zhaw.ch> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-PMX-Spam: Gauge=IIIIIIII, Probability=8%, Report=' FROM_NAME_ONE_WORD 0.05, HTML_00_01 0.05, HTML_00_10 0.05, BODYTEXTP_SIZE_3000_LESS 0, BODY_SIZE_2000_2999 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, REFERENCES 0, __ANY_URI 0, __BOUNCE_CHALLENGE_SUBJ 0, __BOUNCE_NDR_SUBJ_EXEMPT 0, __CT 0, __CTE 0, __CT_TEXT_PLAIN 0, __FORWARDED_MSG 0, __FRAUD_CONTACT_ADDY_B 0, __HAS_FROM 0, __HAS_MSGID 0, __IN_REP_TO 0, __MIME_TEXT_ONLY 0, __MIME_VERSION 0, __MOZILLA_MSGID 0, __MOZILLA_USER_AGENT 0, __REFERENCES 0, __SANE_MSGID 0, __SUBJ_ALPHA_END 0, __SUBJ_ALPHA_NEGATE 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __URI_NO_PATH 0, __URI_NO_WWW 0, __URI_NS , __USER_AGENT 0' X-IsSubscribed: yes Subject: Re: [ECOS] How to attach higher ethernet stacks to the MAC driver X-SW-Source: 2015-05/txt/msg00006.txt.bz2 Hi On 21.05.2015 18:39, Incubus84@web.de wrote: > Hi all, > > I have a question regarding the connection between a mac-/phy-driver and a third > party tcp / ip stack. In the mac layer I have functions like > y_eth_isr, y_eth_init, y_eth_send, y_eth_recv, ... and many more. > > In y_eth_init I attached an ISR (y_eth_isr) and the default DSR (eth_drv_dsr). > > As far as I understood, the data flow is as follows: > 1) The MAC (Hardware) receives an ethernet frame and creates an interrupt > 2) y_eth_isr is called ( ret = (CYG_ISR_HANDLED | CYG_ISR_CALL_DSR); ) > 3) The default eth_drv_dsr is called > 4) y_eth_deliver is called > 5) y_eth_poll is called > 6) The default eth_drv_recv is called > 7) y_eth_recv in the mac driver is called This seems correct so far. > > This is not what I really could proove but what I investigated by reading the > documentation and source code. Now.. my consideration was that I simply have to > add the call to the receive function of the tcp/ip stack in y_eth_recv. Is this > the right approach? Well I thik it's depends on the Stack. The FreeBSD-Stack does some more things on the eth_drv Level. ether_input Net/bsd_tcpip/current/sry/sys/net/if_ethersubr.c ether_demux Net/bsd_tcpip/current/sry/sys/net/if_ethersubr.c after this two routines the packet is handed over to ip_input wich runs on a lower priority. I would presume you would also need to do some things before calling the tcp stack to be 802.1 compliant. Maybe these files give you an input. > > Another point: how can I reliable test the function of my hardware? I plugged in > my device into an ethernet switch which says that there is a link. Using ipconfig > under Windows just says -not connected-. Using ping is not a solution of course, > because I have no ip address... This is a hard one. Testing on this level is not easy. If you just want to see if the stack is running. You could also use arping and see with wireshark if you detect an answer. Testing of the whole system is much more difficult, you would need some sort of Mock /virtalisation of the different layers, which is really hard because of the timings etc. > > And a third question: in the send function of the tcp/ip stack I have to forward > the send buffer to y_eth_send in the mac layer. I simply do this by calling > y_eth0_sc.funs->send(...). Is this the suitable way? > This sounds also fine. Of course someone must handle the memory management of the sendbuffer. > Kind Regards, > Dennis > I hope this helps Serafin -- Serafin Leschke, BSc in Computer Science UAS Zurich Research Assistant -- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss