Re: Can a network driver loopback the data?

From: sara (saravanan_sprt_at_rediffmail.com)
Date: 12/28/04


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.



Relevant Pages

  • [opensuse] openSUSE 10.3 not detecting SATA HD
    ... the sata_sis driver. ... I've tried turning off ACPI in bios and acpi=off which ... openSUSE 10.2 and all my hardware is working fine. ... info.product = 'USB Raw Device Access' ...
    (SuSE)
  • Re: 2008 SBS no longer boots
    ... driver issue initially, the fact that it seems to happen randomly now ... weird with a hardware problem that consistently doesn't get through boot ... other customer, even a 2 week old one, the problem immediately returned. ... There was a time when a server was fired up with a specialized OS and had a battery of tests run against each component to purposefully stress it. ...
    (microsoft.public.windows.server.sbs)
  • Re: Linux, X, ld, gcc, linking, shared libraries and stuff
    ... >> because, originally, video cards / system RAM could NOT afford to have ... > GL actually "copies" everything, but it's done by the graphics card, so ... > anyway if it's not hardware accelerated. ... installed the proper driver, then it zooms around the screen... ...
    (alt.lang.asm)
  • Re: 2008 SBS no longer boots
    ... Any thermal issues and a lot of other hardware problems should show up ... Happen to know a tool to determine driver load order by just having the ... other customer, even a 2 week old one, the problem immediately returned. ... There was a time when a server (even one that had been "burned ...
    (microsoft.public.windows.server.sbs)
  • Re: FreeBSD 7.0 problems
    ... Ergo I can't fault the hardware in any way. ... The wifi driver complains of timeout errors. ... vendor = 'Intel Corporation' ... ABI class: ...
    (freebsd-questions)