Hi ,

I need you help with some networking related Linux/kernel issues.

1) I do have a question related to setsockopt() too:

I am using the following settings:

/proc/sys/net/core/wmem_default 65535
/proc/sys/net/core/rmem_default 65535 
/proc/sys/net/core/wmem_max     65535
/proc/sys/net/core/rmem_max     65535

and I am running an application where I use setsockopt()
to set socket buffer to 80K for example.
I check the setting by using getsockopt and I
am getting 128K instead of 80K.

I looked into the implementation and here is the code:

filename: /usr/src/linux/net/core/sock.c

function: int sock_setsockopt(struct socket *sock, int level, int optname,
                    char *optval, int optlen)

           {
           ....
            case SO_SNDBUF:
                        /* Don't error on this BSD doesn't and if you think
                           about it this is right. Otherwise apps have to
                           play 'guess the biggest size' games. RCVBUF/SNDBUF
                           are treated in BSD as hints */

                        if (val > sysctl_wmem_max)
                                val = sysctl_wmem_max;

                        sk->sndbuf = max(val*2,2048);

                        /*
                         *      Wake up sending tasks if we
                         *      upped the value.
                         */
                        sk->write_space(sk);
                        break;

                case SO_RCVBUF:
                        /* Don't error on this BSD doesn't and if you think
                           about it this is right. Otherwise apps have to
                           play 'guess the biggest size' games. RCVBUF/SNDBUF
                           are treated in BSD as hints */

                        if (val > sysctl_rmem_max)
                                val = sysctl_rmem_max;

                        /* FIXME: is this lower bound the right one? */
                        sk->rcvbuf = max(val*2,256);
                        break;
               .....
               }


QUESTION: why the code is setting sk->sndbuf = max(val*2,2048);
                                  sk->rcvbuf = max(val*2,256);

          2*val instead of val ?


         Is there any additional kernel space required ?
         
         What will be the Linux equivalent of the BSD mbufs used in net
         code ? 

        In BSD you can control the mbufs settings by manipulating certain
        system params and you can get more mbufs for the sockets, e.g.
        netstat -m
        1 mbufs in use:
        1 mbufs allocated to packet headers
        0/46 mapped pages in use
        124 Kbytes allocated to network (0% in use)
        0 requests for memory denied
        0 requests for memory delayed
        0 calls to protocol drain routines

        Is there something similar under Linux ?

Thanks.

2) On a related issue, I do find very useful the BSD-style for netstat -s -p udp 
where you can actually say where the errors are coming from , e.g.

udp:
        242341 datagrams received
        0 with incomplete header
        2 with bad data length field
        6 with bad checksum
        693 dropped due to no socket
        198603 broadcast/multicast datagrams dropped due to no socket
        531 dropped due to full socket buffers
        42506 delivered
        9292 PCB hash misses
        2738326 datagrams output


In linux we have:

Udp:
    122 packets received
    17 packets to unknown port received.
    0 packet receive errors
    141 packets sent

QUESTION: Does anybody know the system calls to determine
          the errors "dropped due to full socket buffer ?


Thanks.

3) On another related issue:

I did some tests with bursty traffic using an SMC eth card and I got  lots
of transmission errors when I used the default setting in ifconfig TX len
= 100. I had to set it to 1000 to get rid of my errors.

QUESTION: Does anybody know how can I access a similar parameter for RX
          queue len ? Since now the bursts are getting dropped at RX side.

Here is the ifconfig of a eth card; the man page of ifconfig let me set
the txqueuelen but no reference to any rxqueuelen.

eth0      Link encap:Ethernet  HWaddr 00:E0:18:A8:56:70  
          inet addr:172.31.17.202  Bcast:172.31.17.255  Mask:255.255.255.0
          UP BROADCAST RUNNING  MTU:1500  Metric:1
          RX packets:86326 errors:1 dropped:0 overruns:0 frame:1
          TX packets:582 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          Interrupt:9 Base address:0xb800 


Is this a issue with the NIC card or is a kernel setting ?

Thanks,
Marian. 

On Tue, 2 May 2000, Glynn Clements wrote:

> 
> Asad Khan Awan wrote:
> 
> > I wanted to findout that if i keep sending data to a tcp/ip scoket and on
> > the receiving side I dont call the receive (or the read) function then what
> > happnes when the buffer for the socket fills up. I'm talking about the
> > buffer handeled by the kernel, where data is stored till read function is
> > called. can i set the size of this buffer using some function.
> 
>       int size = ???;
>       setsockopt(sock_fd, SOL_SOCKET, SO_SNDBUF, &size, sizeof(size));
> and
>       setsockopt(sock_fd, SOL_SOCKET, SO_RCVBUF, &size, sizeof(size));
> 
> -- 
> Glynn Clements <[EMAIL PROTECTED]>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-net" in
> the body of a message to [EMAIL PROTECTED]
> 

-
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to [EMAIL PROTECTED]

Reply via email to