Sponsored Content
Top Forums UNIX for Advanced & Expert Users My NIC driver couldn't send and recieve data simultaneously? Post 302657485 by liklstar on Sunday 17th of June 2012 10:52:42 PM
Old 06-17-2012
My NIC driver couldn't send and recieve data simultaneously?

Hi, all:

My writed NIC driver for rtl8139d adapter on linux 3.0.4 cannot send and recieve simultaneously but is able to send or recieve in parallel respectively. As soon as it send and recieve at the same time, the transmmition rate on both directions gradually decrease to zero b/s and report "stalled" at the end. One interesting phenomenon is that when sending and recieving in parallel the packet size is ofen very small such as 66 bytes, 140bytes and so on. Is this a clue to find the bug?

At beginning I suspect something wrong in the use of spinlock, after my carefully check, however, I could not find any problem. I use two spinlocks, one is for sending the other is for recieving in the interrupt handler.

So, what and where is the cause of this problem? Could anybody give me some idea?


li,kunlun

Moderator's Comments:
Mod Comment Double post, continued here

Last edited by pludi; 06-18-2012 at 07:55 AM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

NIC driver building question

I'm way confused. I loaded RH 7.1 on an old P-75 Compaq. IT has an EtherExpress pro/100 card in it and I have that attached to the optional port on our firewall with a crossover....I can't seem to get the card to negotiate with the firewall...it's currently 100Meg at Half duplex. I'm at a loss... (3 Replies)
Discussion started by: kwalter
3 Replies

2. UNIX for Advanced & Expert Users

NIC Driver

Hi:- I am trying to install a device driver for Intel NIC card on TurboLinux, but getting following errors, cc -O -Wall -o eepro100-diag eepro100-diag.c eepro100-diag.c:72: unistd.h: No such file or directory eepro100-diag.c:73: stdio.h: No such file or directory eepro100-diag.c:74:... (1 Reply)
Discussion started by: s_aamir
1 Replies

3. UNIX for Dummies Questions & Answers

What is my UDP send/recieve buffer size

Hi, If some one was to suggest, "increase your kernal tunables related to UDP, in particular the UDP send/recieve buffer size".... then what would they mean? :confused: How can I find out what this current value is? Thousand many thanks. Neil (3 Replies)
Discussion started by: nhatch
3 Replies

4. IP Networking

NIC driver guide

Hi I need to know how a driver for a network interface card works, I want to learn the basic principles since I know that every driver has its specific implementation. For example when we speak about the scheduler, we can read an operating system book and learn general design concepts e.g.... (0 Replies)
Discussion started by: Puntino
0 Replies

5. AIX

Sample C program to Send/Recieve a file using Socket

Hi All, I urgently need a Sample C program to Send/Recieve a file using Socket. Thanks Sara (1 Reply)
Discussion started by: saraperu
1 Replies

6. UNIX for Advanced & Expert Users

sftp error:- Couldn't send packet: Broken pipe

Hi, I am trying to sftp a large file(appx. 2 GB size) from solaris 10 to a Linux server. While sftping(with no options), connection is terminated after some time with broken pipe error. sftp with option -R1 or -B1500 is successful. Linux server ssh Version: OpenSSH_3.9p1, OpenSSL 0.9.7a... (3 Replies)
Discussion started by: brij123
3 Replies

7. Solaris

x86 Solaris 10 nic driver added but not attached. NIC is not detected.

I couldn't install my nic in solaris 10. I compiled and added the driver but failed to attach the driver and ifconfig output shows only loopback dev. Please see the following output and tell me whether my nic has been detected and why the driver failed to attach? My nic is detected in linux... (0 Replies)
Discussion started by: vectrum
0 Replies

8. Solaris

Packaging driver for NIC

Hi guys My friend needs nfo driver for his Solaris box. I installed that driver for myself from scratch and he needs that driver in SVR4 format. I downloaded source code and run make and this is the point I don't how to proceed. How can I recognize which needs go to the package ? Does make... (0 Replies)
Discussion started by: solaris_user
0 Replies

9. Programming

My NIC driver cannot send and recieve in parallel!

Hi, all: My writed NIC driver for rtl8139d adapter on linux 3.0.4 cannot send and recieve simultaneously but is able to send or recieve in parallel respectively. As soon as it send and recieve at the same time, the transmmition rate on both directions gradually decrease to zero b/s and report... (1 Reply)
Discussion started by: liklstar
1 Replies

10. Solaris

Finding the NIC driver version on Solaris 11

In Solaris 10 it was easy, a simple grep through modinfo output and you'd have the version of any loaded module, including your NIC drivers. In my career I've seen many people relying on this information in their scripts. Now I'm on Solaris 11, and where have the version numbers gone? The... (0 Replies)
Discussion started by: cambridge
0 Replies
ZERO_COPY(9)						   BSD Kernel Developer's Manual					      ZERO_COPY(9)

NAME
zero_copy, zero_copy_sockets -- zero copy sockets code SYNOPSIS
options SOCKET_SEND_COW options SOCKET_RECV_PFLIP DESCRIPTION
The FreeBSD kernel includes a facility for eliminating data copies on socket reads and writes. This code is collectively known as the zero copy sockets code, because during normal network I/O, data will not be copied by the CPU at all. Rather it will be DMAed from the user's buffer to the NIC (for sends), or DMAed from the NIC to a buffer that will then be given to the user (receives). The zero copy sockets code uses the standard socket read and write semantics, and therefore has some limitations and restrictions that pro- grammers should be aware of when trying to take advantage of this functionality. For sending data, there are no special requirements or capabilities that the sending NIC must have. The data written to the socket, though, must be at least a page in size and page aligned in order to be mapped into the kernel. If it does not meet the page size and alignment con- straints, it will be copied into the kernel, as is normally the case with socket I/O. The user should be careful not to overwrite buffers that have been written to the socket before the data has been freed by the kernel, and the copy-on-write mapping cleared. If a buffer is overwritten before it has been given up by the kernel, the data will be copied, and no savings in CPU utilization and memory bandwidth utilization will be realized. The socket(2) API does not really give the user any indication of when his data has actually been sent over the wire, or when the data has been freed from kernel buffers. For protocols like TCP, the data will be kept around in the kernel until it has been acknowledged by the other side; it must be kept until the acknowledgement is received in case retransmission is required. From an application standpoint, the best way to guarantee that the data has been sent out over the wire and freed by the kernel (for TCP- based sockets) is to set a socket buffer size (see the SO_SNDBUF socket option in the setsockopt(2) manual page) appropriate for the applica- tion and network environment and then make sure you have sent out twice as much data as the socket buffer size before reusing a buffer. For TCP, the send and receive socket buffer sizes generally directly correspond to the TCP window size. For receiving data, in order to take advantage of the zero copy receive code, the user must have a NIC that is configured for an MTU greater than the architecture page size. (E.g., for i386 it would be 4KB.) Additionally, in order for zero copy receive to work, packet payloads must be at least a page in size and page aligned. Achieving page aligned payloads requires a NIC that can split an incoming packet into multiple buffers. It also generally requires some sort of intelligence on the NIC to make sure that the payload starts in its own buffer. This is called ``header splitting''. Currently the only NICs with support for header splitting are Alteon Tigon 2 based boards running slightly modified firmware. The FreeBSD ti(4) driver includes modified firmware for Tigon 2 boards only. Header splitting code can be written, however, for any NIC that allows putting received packets into multiple buffers and that has enough programmability to determine that the header should go into one buffer and the payload into another. You can also do a form of header splitting that does not require any NIC modifications if your NIC is at least capable of splitting packets into multiple buffers. This requires that you optimize the NIC driver for your most common packet header size. If that size (ethernet + IP + TCP headers) is generally 66 bytes, for instance, you would set the first buffer in a set for a particular packet to be 66 bytes long, and then subsequent buffers would be a page in size. For packets that have headers that are exactly 66 bytes long, your payload will be page aligned. The other requirement for zero copy receive to work is that the buffer that is the destination for the data read from a socket must be at least a page in size and page aligned. Obviously the requirements for receive side zero copy are impossible to meet without NIC hardware that is programmable enough to do header splitting of some sort. Since most NICs are not that programmable, or their manufacturers will not share the source code to their firmware, this approach to zero copy receive is not widely useful. There are other approaches, such as RDMA and TCP Offload, that may potentially help alleviate the CPU overhead associated with copying data out of the kernel. Most known techniques require some sort of support at the NIC level to work, and describing such techniques is beyond the scope of this manual page. The zero copy send and zero copy receive code can be individually turned off via the kern.ipc.zero_copy.send and kern.ipc.zero_copy.receive sysctl variables respectively. SEE ALSO
sendfile(2), socket(2), ti(4) HISTORY
The zero copy sockets code first appeared in FreeBSD 5.0, although it has been in existence in patch form since at least mid-1999. AUTHORS
The zero copy sockets code was originally written by Andrew Gallatin <gallatin@FreeBSD.org> and substantially modified and updated by Kenneth Merry <ken@FreeBSD.org>. BUGS
The COW based send mechanism is not safe and may result in kernel crashes. BSD
October 23, 2012 BSD
All times are GMT -4. The time now is 01:10 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy