Re: Can a network driver loopback the data?
From: sara (saravanan_sprt_at_rediffmail.com)
Date: 12/28/04
- Next message: Tukla Ratte: "Re: which filesystem?"
- Previous message: Uday Mullangi: "boot from usb???"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 28 Dec 2004 06:21:51 -0800
Tasos Kotaras wrote:
> Hi
>
> I'm lately trying - witout success - to setup a software loopback by
> using my network driver. The motivation is to test my network driver
> without the presence of the undelying hardware. More specifically, I
> would like to send UDP data from a user app (sendto) down to my
network
> interface, where the data will be reflected back to the user app for
> reading (recvfrom). Of course, in my driver I switch the destination
and
> source IP addresses, so that the IP stack will not reject the data.
> Moreover I have done all the necessary steps to activate the
interface,
> and route my packets to it. Unfortunately, after I resend the skb
buffer
> up the stack, I lose any track of it.
>
> Now, the interesting bit, is that when I do use the hardware and set
a
> hardware loopback, then this scenario works perfectly! And this is
> despite the additional functionality required, like programming a
> communicator processor, sending the data, then handling the rx
> interrupt, etc. etc.
>
> I guess that the failure of the software loopback scenario, is the
way I
> reflect the data back to the stack. So here are some more details
about
> what I did:
>
> Initially, I tried inside my hard_start_xmit() to call netif_rx(),
after
> I have made the little trick with the IP addresses mentioned above.
What
> I got was silence. Maybe the failure was due to some skb ownership
> implications?
>
> I then tried to clone or copy the skb before sending it upstairs, but
> again I got no results. Finally, I allocated and filled a new skb
(and
> freed the initial one), but again, after netif_rx, I lose any track
of
> the data. This holds although the new skb is filled with exactly the
> same data that I get with the successful hardware loopback scenario.
So
> there is nothing wrong with the packet, be it data, IP address, CRC
or
> whatever.
>
> Does anybody have any idea? Has anybody achieved in making a software
> loopback in a network driver?
> BTW, the documentation I have found so far around the linux
networking
> mechanism is either too superficial (even in the otherwise perfect
> Rubini's book) or too unintelligibly specialized with no pointers to
the
> prerequisite wisdom. So, if you can provide me with some pointers,
> appropriate to someone who might have some experience in module
> programming, but is unwilling to parse every single line of the
kernel
> code, then I will be grateful!
>
> Tasos Kotaras
Hello Tasos Kotaras,
I too want to perform the test as like you. I have my PCI device
and I started writing driver for that . The driver is half way. But I
want to test my device hard_start_xmit function. For this , I want to
pass user data from application through socket interface into my
dev_hard_xmit() function to fill the DMA buffer.
could you tell me how could I pass the data through socket
interface to my device xmit function.
thanks
sara.
- Next message: Tukla Ratte: "Re: which filesystem?"
- Previous message: Uday Mullangi: "boot from usb???"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|