Date: Fri, 27 May 2011 16:26:35 +0800 From: linux JHON <zhanglinuxstar@gmail.com> To: freebsd-net@freebsd.org Subject: [HELP] sendto:No buffer space available Message-ID: <BANLkTikvoRjW-LGxhm%2BDje=ysEh9WWAGTQ@mail.gmail.com>
next in thread | raw e-mail | index | archive | help
My machine has two net interface cards, fxp0 and acl0, but acl0 is down, only fxp0 is working. When I send raw packets through fxp0, it gives the error: sendto: No buffer space available. I have googled, but I found no answer. The netstat -m result is: 67/1223/1290 mbufs in use (current/cache/total) 64/340/404/25600 mbuf clusters in use (current/cache/total/max) 64/320 mbuf+clusters out of packet secondary zone in use (current/cache) 0/167/167/12800 4k (page size) jumbo clusters in use (current/cache/total/max) 0/0/0/6400 9k jumbo clusters in use (current/cache/total/max) 0/0/0/3200 16k jumbo clusters in use (current/cache/total/max) 144K/1653K/1798K bytes allocated to network (current/cache/total) 0/0/0 requests for mbufs denied (mbufs/clusters/mbuf+clusters) 0/0/0 requests for jumbo clusters denied (4k/9k/16k) 0/5/6656 sfbufs in use (current/peak/max) 0 requests for sfbufs denied 0 requests for sfbufs delayed 0 requests for I/O initiated by sendfile 0 calls to protocol drain routines And the ifconfig gives that: alc0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500 options=c3198<VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,TSO4,WOL_MCAST,WOL_MAGIC,VLAN_HWTSO,LINKSTATE> ether xxxxxxxxxxxx media: Ethernet autoselect fxp0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500 options=4219b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,TSO4,WOL_MAGIC,VLAN_HWTSO> ether xxxxxxxxxxx inet xxxxxx netmask 0xffffff00 broadcast xxxxxxxx media: Ethernet autoselect (100baseTX <full-duplex>) status: active plip0: flags=8851<UP,POINTOPOINT,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500 lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384 options=3<RXCSUM,TXCSUM> inet6 fe80::1%lo0 prefixlen 64 scopeid 0x4 inet6 ::1 prefixlen 128 inet 127.0.0.1 netmask 0xff000000 nd6 options=3<PERFORMNUD,ACCEPT_RTADV> The core code of sending packets is as follows: while (num_of_tries-- > 0) { if (sendto (s, datagram, iph->ip_len, 0, (struct sockaddr *) &servaddr, sizeof (servaddr)) < 0) { fprintf (stderr, "Error in sendto:%s\n", strerror(errno)); exit (1); } else { /*usleep(30);*/ if (ft == 0) { fprintf (stderr, "[****************]\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"); ft = 1; } if ((numtries % modval) == 0) fprintf (stderr, "."); } } When I uncomment the sentence: usleep(30), the error disapears. But I want to send packets in high speed, what should I do? Btw, the packets are raw packets. So I thought maybe the kernel send some packets to the net interface card alc0 which doesn't work. How can I bind raw socket with device fxp0???? Thanks in advance.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?BANLkTikvoRjW-LGxhm%2BDje=ysEh9WWAGTQ>