RTEMS Logo

RTEMS 4.9.2 On-Line Library


Network Configuration

PREV UP NEXT Bookshelf RTEMS Network Supplement

3.3.2: Network Configuration

The network configuration is specified by declaring and initializing the rtems_bsdnet_config structure.

struct rtems_bsdnet_config {
  /*
   * This entry points to the head of the ifconfig chain.
   */
  struct rtems_bsdnet_ifconfig *ifconfig;

  /*
   * This entry should be rtems_bsdnet_do_bootp if BOOTP
   * is being used to configure the network, and NULL
   * if BOOTP is not being used.
   */
  void                    (*bootp)(void);

  /*
   * The remaining items can be initialized to 0, in
   * which case the default value will be used.
   */
  rtems_task_priority  network_task_priority;  /* 100        */
  unsigned long        mbuf_bytecount;         /* 64 kbytes  */
  unsigned long        mbuf_cluster_bytecount; /* 128 kbytes */
  char                *hostname;               /* BOOTP      */
  char                *domainname;             /* BOOTP      */
  char                *gateway;                /* BOOTP      */
  char                *log_host;               /* BOOTP      */
  char                *name_server[3];         /* BOOTP      */
  char                *ntp_server[3];          /* BOOTP      */
  unsigned long        sb_efficiency;          /* 2          */
  /* UDP TX: 9216 bytes */
  unsigned long        udp_tx_buf_size;
  /* UDP RX: 40 * (1024 + sizeof(struct sockaddr_in)) */
  unsigned long        udp_rx_buf_size;
  /* TCP TX: 16 * 1024 bytes */
  unsigned long        tcp_tx_buf_size;
  /* TCP TX: 16 * 1024 bytes */
  unsigned long        tcp_rx_buf_size;
};

The structure entries are described in the following table. If your application uses BOOTP/DHCP to obtain network configuration information and if you are happy with the default values described below, you need to provide only the first two entries in this structure.

struct rtems_bsdnet_ifconfig *ifconfig
A pointer to the first configuration structure of the first network device. This structure is described in the following section. You must provide a value for this entry since there is no default value for it.
void (*bootp)(void)
This entry should be set to rtems_bsdnet_do_bootp if your application will use BOOTP/DHCP to obtain network configuration information. It should be set to NULL if your application does not use BOOTP/DHCP.
int network_task_priority
The priority at which the network task and network device receive and transmit tasks will run. If a value of 0 is specified the tasks will run at priority 100.
unsigned long mbuf_bytecount
The number of bytes to allocate from the heap for use as mbufs. If a value of 0 is specified, 64 kbytes will be allocated.
unsigned long mbuf_cluster_bytecount
The number of bytes to allocate from the heap for use as mbuf clusters. If a value of 0 is specified, 128 kbytes will be allocated.
char *hostname
The host name of the system. If this, or any of the following, entries are NULL the value may be obtained from a BOOTP/DHCP server.
char *domainname
The name of the Internet domain to which the system belongs.
char *gateway
The Internet host number of the network gateway machine, specified in 'dotted decimal' (129.128.4.1) form.
char *log_host
The Internet host number of the machine to which syslog messages will be sent.
char *name_server[3]
The Internet host numbers of up to three machines to be used as Internet Domain Name Servers.
char *ntp_server[3]
The Internet host numbers of up to three machines to be used as Network Time Protocol (NTP) Servers.
unsigned long sb_efficiency
This is the first of five configuration parameters related to the amount of memory each socket may consume for buffers. The TCP/IP stack reserves buffers (e.g. mbufs) for each open socket. The TCP/IP stack has different limits for the transmit and receive buffers associated with each TCP and UDP socket. By tuning these parameters, the application developer can make trade-offs between memory consumption and performance. The default parameters favor performance over memory consumption. See for more details but note that after the RTEMS 4.8 release series, the sb_efficiency default was changed from 8 to 2.

The user should also be aware of the SO_SNDBUF and SO_RCVBUF IO control operations. These can be used to specify the send and receive buffer sizes for a specific socket. There is no standard IO control to change the sb_efficiency factor.

The sb_efficiency parameter is a buffering factor used in the implementation of the TCP/IP stack. The default is 2 which indicates double buffering. When allocating memory for each socket, this number is multiplied by the buffer sizes for that socket.

unsigned long udp_tx_buf_size
This configuration parameter specifies the maximum amount of buffer memory which may be used for UDP sockets to transmit with. The default size is 9216 bytes which corresponds to the maximum datagram size.
unsigned long udp_rx_buf_size
This configuration parameter specifies the maximum amount of buffer memory which may be used for UDP sockets to receive into. The default size is the following length in bytes:
40 * (1024 + sizeof(struct sockaddr_in)
unsigned long tcp_tx_buf_size
This configuration parameter specifies the maximum amount of buffer memory which may be used for TCP sockets to transmit with. The default size is sixteen kilobytes.
unsigned long tcp_rx_buf_size
This configuration parameter specifies the maximum amount of buffer memory which may be used for TCP sockets to receive into. The default size is sixteen kilobytes.

In addition, the following fields in the rtems_bsdnet_ifconfig are of interest.

int port
The I/O port number (ex: 0x240) on which the external Ethernet can be accessed.
int irno
The interrupt number of the external Ethernet controller.
int bpar
The address of the shared memory on the external Ethernet controller.


PREV UP NEXT Bookshelf RTEMS Network Supplement

Copyright © 1988-2008 OAR Corporation