source: rtems-docs/networking/networking_old_reference_only.rst @ 489740f

4.115
Last change on this file since 489740f was 489740f, checked in by Chris Johns <chrisj@…>, on 05/20/16 at 02:47:09

Set SPDX License Identifier in each source file.

  • Property mode set to 100644
File size: 72.5 KB
Line 
1.. comment SPDX-License-Identifier: CC-BY-SA-4.0
2
3:orphan:
4
5
6
7.. COMMENT: %**end of header
8
9.. COMMENT: COPYRIGHT (c) 1989-2013.
10
11.. COMMENT: On-Line Applications Research Corporation (OAR).
12
13.. COMMENT: All rights reserved.
14
15.. COMMENT: Master file for the network Supplement
16
17.. COMMENT: COPYRIGHT (c) 1988-2002.
18
19.. COMMENT: On-Line Applications Research Corporation (OAR).
20
21.. COMMENT: All rights reserved.
22
23.. COMMENT: The following determines which set of the tables and figures we will use.
24
25.. COMMENT: We default to ASCII but if available TeX or HTML versions will
26
27.. COMMENT: be used instead.
28
29.. COMMENT: @clear use-html
30
31.. COMMENT: @clear use-tex
32
33.. COMMENT: The following variable says to use texinfo or html for the two column
34
35.. COMMENT: texinfo tables.  For somethings the format does not look good in html.
36
37.. COMMENT: With our adjustment to the left column in TeX, it nearly always looks
38
39.. COMMENT: good printed.
40
41.. COMMENT: Custom whitespace adjustments.  We could fiddle a bit more.
42
43.. COMMENT: Title Page Stuff
44
45.. COMMENT: I don't really like having a short title page.  -joel
46
47.. COMMENT: @shorttitlepage RTEMS Network Supplement
48
49========================
50RTEMS Network Supplement
51========================
52
53.. COMMENT: COPYRIGHT (c) 1988-2015.
54
55.. COMMENT: On-Line Applications Research Corporation (OAR).
56
57.. COMMENT: All rights reserved.
58
59.. COMMENT: The following puts a space somewhere on an otherwise empty page so we
60
61.. COMMENT: can force the copyright description onto a left hand page.
62
63COPYRIGHT © 1988 - 2015.
64
65On-Line Applications Research Corporation (OAR).
66
67The authors have used their best efforts in preparing
68this material.  These efforts include the development, research,
69and testing of the theories and programs to determine their
70effectiveness.  No warranty of any kind, expressed or implied,
71with regard to the software or the material contained in this
72document is provided.  No liability arising out of the
73application or use of any product described in this document is
74assumed.  The authors reserve the right to revise this material
75and to make changes from time to time in the content hereof
76without obligation to notify anyone of such revision or changes.
77
78The RTEMS Project is hosted at http://www.rtems.org.  Any
79inquiries concerning RTEMS, its related support components, or its
80documentation should be directed to the Community Project hosted athttp://www.rtems.org.
81
82Any inquiries for commercial services including training, support, custom
83development, application development assistance should be directed tohttp://www.rtems.com.
84
85.. COMMENT: This prevents a black box from being printed on "overflow" lines.
86
87.. COMMENT: The alternative is to rework a sentence to avoid this problem.
88
89RTEMS TCP/IP Networking Supplement
90##################################
91
92.. COMMENT: COPYRIGHT (c) 1989-2011.
93
94.. COMMENT: On-Line Applications Research Corporation (OAR).
95
96.. COMMENT: All rights reserved.
97
98Preface
99#######
100
101This document describes the RTEMS specific parts of the FreeBSD TCP/IP
102stack.  Much of this documentation was written by Eric Norum
103(eric@skatter.usask.ca)
104of the Saskatchewan Accelerator Laboratory
105who also ported the FreeBSD TCP/IP stack to RTEMS.
106
107The following is a list of resources which should be useful in trying
108to understand Ethernet:
109
110- *Charles Spurgeon’s Ethernet Web Site*
111  "This site provides extensive information about Ethernet
112  (IEEE 802.3) local area network (LAN) technology. Including
113  the original 10 Megabit per second (Mbps) system, the 100 Mbps
114  Fast Ethernet system (802.3u), and the Gigabit Ethernet system (802.3z)."
115  The URL is:
116  (http://www.ethermanage.com/ethernet/ethernet.html)
117
118- *TCP/IP Illustrated, Volume 1 : The Protocols* by
119  by W. Richard Stevens (ISBN: 0201633469)
120  This book provides detailed introduction to TCP/IP and includes diagnostic
121  programs which are publicly available.
122
123- *TCP/IP Illustrated, Volume 2 : The Implementation* by W. Richard
124  Stevens and Gary Wright (ISBN: 020163354X)
125  This book focuses on implementation issues regarding TCP/IP.  The
126  treat for RTEMS users is that the implementation covered is the BSD
127  stack with most of the source code described in detail.
128
129- *UNIX Network Programming, Volume 1 : 2nd Edition* by W. Richard
130  Stevens (ISBN: 0-13-490012-X)
131  This book describes how to write basic TCP/IP applications, again with primary
132  focus on the BSD stack.
133
134.. COMMENT: Written by Eric Norum
135
136.. COMMENT: COPYRIGHT (c) 1988-2002.
137
138.. COMMENT: On-Line Applications Research Corporation (OAR).
139
140.. COMMENT: All rights reserved.
141
142Network Task Structure and Data Flow
143####################################
144
145A schematic diagram of the tasks and message *mbuf* queues in a
146simple RTEMS networking application is shown in the following
147figure:
148
149.. image:: images/networkflow.jpg
150
151
152The transmit task  for each network interface is normally blocked waiting
153for a packet to arrive in the transmit queue.  Once a packet arrives, the
154transmit task may block waiting for an event from the transmit interrupt
155handler.  The transmit interrupt handler sends an RTEMS event to the transmit
156task to indicate that transmit hardware resources have become available.
157
158The receive task for each network interface is normally blocked waiting
159for an event from the receive interrupt handler.  When this event is received
160the receive task reads the packet and forwards it to the network stack
161for subsequent processing by the network task.
162
163The network task processes incoming packets and takes care of
164timed operations such as handling TCP timeouts and
165aging and removing routing table entries.
166
167The ‘Network code’ contains routines which may run in the context of
168the user application tasks, the interface receive task or the network task.
169A network semaphore ensures that
170the data structures manipulated by the network code remain consistent.
171
172.. COMMENT: Written by Eric Norum
173
174.. COMMENT: COPYRIGHT (c) 1988-2002.
175
176.. COMMENT: On-Line Applications Research Corporation (OAR).
177
178.. COMMENT: All rights reserved.
179
180Networking Driver
181#################
182
183Introduction
184============
185
186This chapter is intended to provide an introduction to the
187procedure for writing RTEMS network device drivers.
188The example code is taken from the ‘Generic 68360’ network device
189driver.  The source code for this driver is located in the``c/src/lib/libbsp/m68k/gen68360/network`` directory in the RTEMS
190source code distribution.  Having a copy of this driver at
191hand when reading the following notes will help significantly.
192
193Learn about the network device
194==============================
195
196Before starting to write the network driver become completely
197familiar with the programmer’s view of the device.
198The following points list some of the details of the
199device that must be understood before a driver can be written.
200
201- Does the device use DMA to transfer packets to and from
202  memory or does the processor have to
203  copy packets to and from memory on the device?
204
205- If the device uses DMA, is it capable of forming a single
206  outgoing packet from multiple fragments scattered in separate
207  memory buffers?
208
209- If the device uses DMA, is it capable of chaining multiple
210  outgoing packets, or does each outgoing packet require
211  intervention by the driver?
212
213- Does the device automatically pad short frames to the minimum
214  64 bytes or does the driver have to supply the padding?
215
216- Does the device automatically retry a transmission on detection
217  of a collision?
218
219- If the device uses DMA, is it capable of buffering multiple
220  packets to memory, or does the receiver have to be restarted
221  after the arrival of each packet?
222
223- How are packets that are too short, too long, or received with
224  CRC errors handled?  Does the device automatically continue
225  reception or does the driver have to intervene?
226
227- How is the device Ethernet address set?  How is the device
228  programmed to accept or reject broadcast and multicast packets?
229
230- What interrupts does the device generate?  Does it generate an
231  interrupt for each incoming packet, or only for packets received
232  without error?  Does it generate an interrupt for each packet
233  transmitted, or only when the transmit queue is empty?  What
234  happens when a transmit error is detected?
235
236In addition, some controllers have specific questions regarding
237board specific configuration.  For example, the SONIC Ethernet
238controller has a very configurable data bus interface.  It can
239even be configured for sixteen and thirty-two bit data buses.  This
240type of information should be obtained from the board vendor.
241
242Understand the network scheduling conventions
243=============================================
244
245When writing code for the driver transmit and receive tasks,
246take care to follow the network scheduling conventions.  All tasks
247which are associated with networking share various
248data structures and resources.  To ensure the consistency
249of these structures the tasks
250execute only when they hold the network semaphore (``rtems_bsdnet_semaphore``).
251The transmit and receive tasks must abide by this protocol.  Be very
252careful to avoid ‘deadly embraces’ with the other network tasks.
253A number of routines are provided to make it easier for the network
254driver code to conform to the network task scheduling conventions.
255
256- ``void rtems_bsdnet_semaphore_release(void)``
257  This function releases the network semaphore.
258  The network driver tasks must call this function immediately before
259  making any blocking RTEMS request.
260
261- ``void rtems_bsdnet_semaphore_obtain(void)``
262  This function obtains the network semaphore.
263  If a network driver task has released the network semaphore to allow other
264  network-related tasks to run while the task blocks, then this function must
265  be called to reobtain the semaphore immediately after the return from the
266  blocking RTEMS request.
267
268- ``rtems_bsdnet_event_receive(rtems_event_set, rtems_option, rtems_interval, rtems_event_set \*)``
269  The network driver task should call this function when it wishes to wait
270  for an event.  This function releases the network semaphore,
271  calls ``rtems_event_receive`` to wait for the specified event
272  or events and reobtains the semaphore.
273  The value returned is the value returned by the ``rtems_event_receive``.
274
275Network Driver Makefile
276=======================
277
278Network drivers are considered part of the BSD network package and as such
279are to be compiled with the appropriate flags.  This can be accomplished by
280adding ``-D__INSIDE_RTEMS_BSD_TCPIP_STACK__`` to the ``command line``.
281If the driver is inside the RTEMS source tree or is built using the
282RTEMS application Makefiles, then adding the following line accomplishes
283this:
284.. code:: c
285
286    DEFINES += -D__INSIDE_RTEMS_BSD_TCPIP_STACK__
287
288This is equivalent to the following list of definitions.  Early versions
289of the RTEMS BSD network stack required that all of these be defined.
290
291.. code:: c
292
293    -D_COMPILING_BSD_KERNEL_ -DKERNEL -DINET -DNFS \\
294    -DDIAGNOSTIC -DBOOTP_COMPAT
295
296Defining these macros tells the network header files that the driver
297is to be compiled with extended visibility into the network stack.  This
298is in sharp contrast to applications that simply use the network stack.
299Applications do not require this level of visibility and should stick
300to the portable application level API.
301
302As a direct result of being logically internal to the network stack,
303network drivers use the BSD memory allocation routines   This means,
304for example, that malloc takes three arguments.  See the SONIC
305device driver (``c/src/lib/libchip/network/sonic.c``) for an example
306of this.  Because of this, network drivers should not include``<stdlib.h>``.  Doing so will result in conflicting definitions
307of ``malloc()``.
308
309*Application level* code including network servers such as the FTP
310daemon are *not* part of the BSD kernel network code and should not be
311compiled with the BSD network flags.  They should include``<stdlib.h>`` and not define the network stack visibility
312macros.
313
314Write the Driver Attach Function
315================================
316
317The driver attach function is responsible for configuring the driver
318and making the connection between the network stack
319and the driver.
320
321Driver attach functions take a pointer to an``rtems_bsdnet_ifconfig`` structure as their only argument.
322and set the driver parameters based on the
323values in this structure.  If an entry in the configuration
324structure is zero the attach function chooses an
325appropriate default value for that parameter.
326
327The driver should then set up several fields in the ifnet structure
328in the device-dependent data structure supplied and maintained by the driver:
329
330``ifp->if_softc``
331    Pointer to the device-dependent data.  The first entry
332    in the device-dependent data structure must be an ``arpcom``
333    structure.
334
335``ifp->if_name``
336    The name of the device.  The network stack uses this string
337    and the device number for device name lookups.  The device name should
338    be obtained from the ``name`` entry in the configuration structure.
339
340``ifp->if_unit``
341    The device number.  The network stack uses this number and the
342    device name for device name lookups.  For example, if``ifp->if_name`` is ‘``scc``’ and ``ifp->if_unit`` is ‘``1``’,
343    the full device name would be ‘``scc1``’.  The unit number should be
344    obtained from the ‘name’ entry in the configuration structure.
345
346``ifp->if_mtu``
347    The maximum transmission unit for the device.  For Ethernet
348    devices this value should almost always be 1500.
349
350``ifp->if_flags``
351    The device flags.  Ethernet devices should set the flags
352    to ``IFF_BROADCAST|IFF_SIMPLEX``, indicating that the
353    device can broadcast packets to multiple destinations
354    and does not receive and transmit at the same time.
355
356``ifp->if_snd.ifq_maxlen``
357    The maximum length of the queue of packets waiting to be
358    sent to the driver.  This is normally set to ``ifqmaxlen``.
359
360``ifp->if_init``
361    The address of the driver initialization function.
362
363``ifp->if_start``
364    The address of the driver start function.
365
366``ifp->if_ioctl``
367    The address of the driver ioctl function.
368
369``ifp->if_output``
370    The address of the output function.  Ethernet devices
371    should set this to ``ether_output``.
372
373RTEMS provides a function to parse the driver name in the
374configuration structure into a device name and unit number.
375.. code:: c
376
377    int rtems_bsdnet_parse_driver_name (
378    const struct rtems_bsdnet_ifconfig \*config,
379    char \**namep
380    );
381
382The function takes two arguments; a pointer to the configuration
383structure and a pointer to a pointer to a character.  The function
384parses the configuration name entry, allocates memory for the driver
385name, places the driver name in this memory, sets the second argument
386to point to the name and returns the unit number.
387On error, a message is printed and -1 is returned.
388
389Once the attach function  has set up the above entries it must link the
390driver data structure onto the list of devices by
391calling ``if_attach``.  Ethernet devices should then
392call ``ether_ifattach``.  Both functions take a pointer to the
393device’s ``ifnet`` structure as their only argument.
394
395The attach function should return a non-zero value to indicate that
396the driver has been successfully configured and attached.
397
398Write the Driver Start Function.
399================================
400
401This function is called each time the network stack wants to start the
402transmitter.  This occures whenever the network stack adds a packet
403to a device’s send queue and the ``IFF_OACTIVE`` bit in the
404device’s ``if_flags`` is not set.
405
406For many devices this function need only set the ``IFF_OACTIVE`` bit in the``if_flags`` and send an event to the transmit task
407indicating that a packet is in the driver transmit queue.
408
409Write the Driver Initialization Function.
410=========================================
411
412This function should initialize the device, attach to interrupt handler,
413and start the driver transmit and receive tasks.  The function
414.. code:: c
415
416    rtems_id
417    rtems_bsdnet_newproc (char \*name,
418    int stacksize,
419    void(\*entry)(void \*),
420    void \*arg);
421
422should be used to start the driver tasks.
423
424Note that the network stack may call the driver initialization function more
425than once.
426Make sure multiple versions of the receive and transmit tasks are not accidentally
427started.
428
429Write the Driver Transmit Task
430==============================
431
432This task is reponsible for removing packets from the driver send queue and sending them to the device.  The task should block waiting for an event from the
433driver start function indicating that packets are waiting to be transmitted.
434When the transmit task has drained the driver send queue the task should clear
435the ``IFF_OACTIVE`` bit in ``if_flags`` and block until another outgoing
436packet is queued.
437
438Write the Driver Receive Task
439=============================
440
441This task should block until a packet arrives from the device.  If the
442device is an Ethernet interface the function ``ether_input`` should be called
443to forward the packet to the network stack.   The arguments to ``ether_input``
444are a pointer to the interface data structure, a pointer to the ethernet
445header and a pointer to an mbuf containing the packet itself.
446
447Write the Driver Interrupt Handler
448==================================
449
450A typical interrupt handler will do nothing more than the hardware
451manipulation required to acknowledge the interrupt and send an RTEMS event
452to wake up the driver receive or transmit task waiting for the event.
453Network interface interrupt handlers must not make any calls to other
454network routines.
455
456Write the Driver IOCTL Function
457===============================
458
459This function handles ioctl requests directed at the device.  The ioctl
460commands which must be handled are:
461
462``SIOCGIFADDR``
463
464``SIOCSIFADDR``
465
466    If the device is an Ethernet interface these
467    commands should be passed on to ``ether_ioctl``.
468
469``SIOCSIFFLAGS``
470
471    This command should be used to start or stop the device,
472    depending on the state of the interface ``IFF_UP`` and``IFF_RUNNING`` bits in ``if_flags``:
473
474    ``IFF_RUNNING``
475
476        Stop the device.
477
478    ``IFF_UP``
479
480        Start the device.
481
482    ``IFF_UP|IFF_RUNNING``
483
484        Stop then start the device.
485
486    ``0``
487
488        Do nothing.
489
490Write the Driver Statistic-Printing Function
491============================================
492
493This function should print the values of any statistic/diagnostic
494counters the network driver may use.  The driver ioctl function should call
495the statistic-printing function when the ioctl command is``SIO_RTEMS_SHOW_STATS``.
496
497.. COMMENT: Written by Eric Norum
498
499.. COMMENT: COPYRIGHT (c) 1988-2002.
500
501.. COMMENT: On-Line Applications Research Corporation (OAR).
502
503.. COMMENT: All rights reserved.
504
505Using Networking in an RTEMS Application
506########################################
507
508Makefile changes
509================
510
511Including the required managers
512-------------------------------
513
514The FreeBSD networking code requires several RTEMS managers
515in the application:
516.. code:: c
517
518    MANAGERS = io event semaphore
519
520Increasing the size of the heap
521-------------------------------
522
523The networking tasks allocate a lot of memory.  For most applications
524the heap should be at least 256 kbytes.
525The amount of memory set aside for the heap can be adjusted by setting
526the ``CFLAGS_LD`` definition as shown below:
527.. code:: c
528
529    CFLAGS_LD += -Wl,--defsym -Wl,HeapSize=0x80000
530
531This sets aside 512 kbytes of memory for the heap.
532
533System Configuration
534====================
535
536The networking tasks allocate some RTEMS objects.  These
537must be accounted for in the application configuration table.  The following
538lists the requirements.
539
540*TASKS*
541    One network task plus a receive and transmit task for each device.
542
543*SEMAPHORES*
544    One network semaphore plus one syslog mutex semaphore if the application uses
545    openlog/syslog.
546
547*EVENTS*
548    The network stack uses ``RTEMS_EVENT_24`` and ``RTEMS_EVENT_25``.
549    This has no effect on the application configuration, but
550    application tasks which call the network functions should not
551    use these events for other purposes.
552
553Initialization
554==============
555
556Additional include files
557------------------------
558
559The source file which declares the network configuration
560structures and calls the network initialization function must include
561.. code:: c
562
563    #include <rtems/rtems_bsdnet.h>
564
565Network Configuration
566---------------------
567
568The network configuration is specified by declaring
569and initializing the ``rtems_bsdnet_config``
570structure.
571.. code:: c
572
573    struct rtems_bsdnet_config {
574    /*
575    * This entry points to the head of the ifconfig chain.
576    \*/
577    struct rtems_bsdnet_ifconfig \*ifconfig;
578    /*
579    * This entry should be rtems_bsdnet_do_bootp if BOOTP
580    * is being used to configure the network, and NULL
581    * if BOOTP is not being used.
582    \*/
583    void                    (\*bootp)(void);
584    /*
585    * The remaining items can be initialized to 0, in
586    * which case the default value will be used.
587    \*/
588    rtems_task_priority  network_task_priority;  /* 100        \*/
589    unsigned long        mbuf_bytecount;         /* 64 kbytes  \*/
590    unsigned long        mbuf_cluster_bytecount; /* 128 kbytes \*/
591    char                \*hostname;               /* BOOTP      \*/
592    char                \*domainname;             /* BOOTP      \*/
593    char                \*gateway;                /* BOOTP      \*/
594    char                \*log_host;               /* BOOTP      \*/
595    char                \*name_server[3];         /* BOOTP      \*/
596    char                \*ntp_server[3];          /* BOOTP      \*/
597    unsigned long        sb_efficiency;          /* 2          \*/
598    /* UDP TX: 9216 bytes \*/
599    unsigned long        udp_tx_buf_size;
600    /* UDP RX: 40 * (1024 + sizeof(struct sockaddr_in)) \*/
601    unsigned long        udp_rx_buf_size;
602    /* TCP TX: 16 * 1024 bytes \*/
603    unsigned long        tcp_tx_buf_size;
604    /* TCP TX: 16 * 1024 bytes \*/
605    unsigned long        tcp_rx_buf_size;
606    /* Default Network Tasks CPU Affinity \*/
607    #ifdef RTEMS_SMP
608    const cpu_set_t     \*network_task_cpuset;
609    size_t               network_task_cpuset_size;
610    #endif
611    };
612
613The structure entries are described in the following table.
614If your application uses BOOTP/DHCP to obtain network configuration
615information and if you are happy with the default values described
616below, you need to provide only the first two entries in this structure.
617
618``struct rtems_bsdnet_ifconfig \*ifconfig``
619
620    A pointer to the first configuration structure of the first network
621    device.  This structure is described in the following section.
622    You must provide a value for this entry since there is no default value for it.
623
624``void (\*bootp)(void)``
625
626    This entry should be set to ``rtems_bsdnet_do_bootp`` if your
627    application by default uses the BOOTP/DHCP client protocol to obtain
628    network configuration information.  It should be set to ``NULL`` if
629    your application does not use BOOTP/DHCP.
630    You can also use ``rtems_bsdnet_do_bootp_rootfs`` to have a set of
631    standard files created with the information return by the BOOTP/DHCP
632    protocol. The IP address is added to :file:`/etc/hosts` with the host
633    name and domain returned. If no host name or domain is returned``me.mydomain`` is used. The BOOTP/DHCP server’s address is also
634    added to :file:`/etc/hosts`. The domain name server listed in the
635    BOOTP/DHCP information are added to :file:`/etc/resolv.conf`. A``search`` record is also added if a domain is returned. The files
636    are created if they do not exist.
637    The default ``rtems_bsdnet_do_bootp`` and``rtems_bsdnet_do_bootp_rootfs`` handlers will loop for-ever
638    waiting for a BOOTP/DHCP server to respond. If an error is detected
639    such as not valid interface or valid hardware address the target will
640    reboot allowing any hardware reset to correct itself.
641    You can provide your own custom handler which allows you to perform
642    an initialization that meets your specific system requirements. For
643    example you could try BOOTP/DHCP then enter a configuration tool if no
644    server is found allowing the user to switch to a static configuration.
645
646``int network_task_priority``
647    The priority at which the network task and network device
648    receive and transmit tasks will run.
649    If a value of 0 is specified the tasks will run at priority 100.
650
651``unsigned long mbuf_bytecount``
652    The number of bytes to allocate from the heap for use as mbufs.
653    If a value of 0 is specified, 64 kbytes will be allocated.
654
655``unsigned long mbuf_cluster_bytecount``
656    The number of bytes to allocate from the heap for use as mbuf clusters.
657    If a value of 0 is specified, 128 kbytes will be allocated.
658
659``char \*hostname``
660    The host name of the system.
661    If this, or any of the following, entries are ``NULL`` the value
662    may be obtained from a BOOTP/DHCP server.
663
664``char \*domainname``
665    The name of the Internet domain to which the system belongs.
666
667``char \*gateway``
668    The Internet host number of the network gateway machine,
669    specified in ’dotted decimal’ (``129.128.4.1``) form.
670
671``char \*log_host``
672    The Internet host number of the machine to which ``syslog`` messages
673    will be sent.
674
675``char \*name_server[3]``
676    The Internet host numbers of up to three machines to be used as
677    Internet Domain Name Servers.
678
679``char \*ntp_server[3]``
680    The Internet host numbers of up to three machines to be used as
681    Network Time Protocol (NTP) Servers.
682
683``unsigned long sb_efficiency``
684    This is the first of five configuration parameters related to
685    the amount of memory each socket may consume for buffers.  The
686    TCP/IP stack reserves buffers (e.g. mbufs) for each open socket.  The
687    TCP/IP stack has different limits for the transmit and receive
688    buffers associated with each TCP and UDP socket.  By tuning these
689    parameters, the application developer can make trade-offs between
690    memory consumption and performance.  The default parameters favor
691    performance over memory consumption.  Seehttp://www.rtems.org/ml/rtems-users/2004/february/msg00200.html
692    for more details but note that after the RTEMS 4.8 release series,
693    the sb_efficiency default was changed from ``8`` to ``2``.
694    The user should also be aware of the ``SO_SNDBUF`` and ``SO_RCVBUF``
695    IO control operations.  These can be used to specify the
696    send and receive buffer sizes for a specific socket.  There
697    is no standard IO control to change the ``sb_efficiency`` factor.
698    The ``sb_efficiency`` parameter is a buffering factor used
699    in the implementation of the TCP/IP stack.  The default is ``2``
700    which indicates double buffering.  When allocating memory for each
701    socket, this number is multiplied by the buffer sizes for that socket.
702
703``unsigned long udp_tx_buf_size``
704
705    This configuration parameter specifies the maximum amount of
706    buffer memory which may be used for UDP sockets to transmit
707    with.  The default size is 9216 bytes which corresponds to
708    the maximum datagram size.
709
710``unsigned long udp_rx_buf_size``
711
712    This configuration parameter specifies the maximum amount of
713    buffer memory which may be used for UDP sockets to receive
714    into.  The default size is the following length in bytes:
715
716    .. code:: c
717
718        40 * (1024 + sizeof(struct sockaddr_in)
719
720``unsigned long tcp_tx_buf_size``
721
722    This configuration parameter specifies the maximum amount of
723    buffer memory which may be used for TCP sockets to transmit
724    with.  The default size is sixteen kilobytes.
725
726``unsigned long tcp_rx_buf_size``
727
728    This configuration parameter specifies the maximum amount of
729    buffer memory which may be used for TCP sockets to receive
730    into.  The default size is sixteen kilobytes.
731
732``const cpu_set_t \*network_task_cpuset``
733
734    This configuration parameter specifies the CPU affinity of the
735    network task. If set to ``0`` the network task can be scheduled on
736    any CPU. Only available in SMP configurations.
737
738``size_t network_task_cpuset_size``
739
740    This configuration parameter specifies the size of the``network_task_cpuset`` used. Only available in SMP configurations.
741
742In addition, the following fields in the ``rtems_bsdnet_ifconfig``
743are of interest.
744
745*int port*
746    The I/O port number (ex: 0x240) on which the external Ethernet
747    can be accessed.
748
749*int irno*
750    The interrupt number of the external Ethernet controller.
751
752*int bpar*
753    The address of the shared memory on the external Ethernet controller.
754
755Network device configuration
756----------------------------
757
758Network devices are specified and configured by declaring and initializing a``struct rtems_bsdnet_ifconfig`` structure for each network device.
759
760The structure entries are described in the following table.  An application
761which uses a single network interface, gets network configuration information
762from a BOOTP/DHCP server, and uses the default values for all driver
763parameters needs to initialize only the first two entries in the
764structure.
765
766``char \*name``
767    The full name of the network device.  This name consists of the
768    driver name and the unit number (e.g. ``"scc1"``).
769    The ``bsp.h`` include file usually defines RTEMS_BSP_NETWORK_DRIVER_NAME as
770    the name of the primary (or only) network driver.
771
772``int (\*attach)(struct rtems_bsdnet_ifconfig \*conf)``
773    The address of the driver ``attach`` function.   The network
774    initialization function calls this function to configure the driver and
775    attach it to the network stack.
776    The ``bsp.h`` include file usually defines RTEMS_BSP_NETWORK_DRIVER_ATTACH as
777    the name of the  attach function of the primary (or only) network driver.
778
779``struct rtems_bsdnet_ifconfig \*next``
780    A pointer to the network device configuration structure for the next network
781    interface, or ``NULL`` if this is the configuration structure of the
782    last network interface.
783
784``char \*ip_address``
785    The Internet address of the device,
786    specified in ‘dotted decimal’ (``129.128.4.2``) form, or ``NULL``
787    if the device configuration information is being obtained from a
788    BOOTP/DHCP server.
789
790``char \*ip_netmask``
791    The Internet inetwork mask of the device,
792    specified in ‘dotted decimal’ (``255.255.255.0``) form, or ``NULL``
793    if the device configuration information is being obtained from a
794    BOOTP/DHCP server.
795
796``void \*hardware_address``
797    The hardware address of the device, or ``NULL`` if the driver is
798    to obtain the hardware address in some other way (usually  by reading
799    it from the device or from the bootstrap ROM).
800
801``int ignore_broadcast``
802    Zero if the device is to accept broadcast packets, non-zero if the device
803    is to ignore broadcast packets.
804
805``int mtu``
806    The maximum transmission unit of the device, or zero if the driver
807    is to choose a default value (typically 1500 for Ethernet devices).
808
809``int rbuf_count``
810    The number of receive buffers to use, or zero if the driver is to
811    choose a default value
812
813``int xbuf_count``
814    The number of transmit buffers to use, or zero if the driver is to
815    choose a default value
816    Keep in mind that some network devices may use 4 or more
817    transmit descriptors for a single transmit buffer.
818
819A complete network configuration specification can be as simple as the one
820shown in the following example.
821This configuration uses a single network interface, gets
822network configuration information
823from a BOOTP/DHCP server, and uses the default values for all driver
824parameters.
825.. code:: c
826
827    static struct rtems_bsdnet_ifconfig netdriver_config = {
828    RTEMS_BSP_NETWORK_DRIVER_NAME,
829    RTEMS_BSP_NETWORK_DRIVER_ATTACH
830    };
831    struct rtems_bsdnet_config rtems_bsdnet_config = {
832    &netdriver_config,
833    rtems_bsdnet_do_bootp,
834    };
835
836Network initialization
837----------------------
838
839The networking tasks must be started before any network I/O operations
840can be performed. This is done by calling:
841
842.. code:: c
843
844    rtems_bsdnet_initialize_network ();
845
846This function is declared in ``rtems/rtems_bsdnet.h``.
847t returns 0 on success and -1 on failure with an error code
848in ``errno``.  It is not possible to undo the effects of
849a partial initialization, though, so the function can be
850called only once irregardless of the return code.  Consequently,
851if the condition for the failure can be corrected, the
852system must be reset to permit another network initialization
853attempt.
854
855Application Programming Interface
856=================================
857
858The RTEMS network package provides almost a complete set of BSD network
859services.  The network functions work like their BSD counterparts
860with the following exceptions:
861
862- A given socket can be read or written by only one task at a time.
863
864- The ``select`` function only works for file descriptors associated
865  with sockets.
866
867- You must call ``openlog`` before calling any of the ``syslog`` functions.
868
869- *Some of the network functions are not thread-safe.*
870  For example the following functions return a pointer to a static
871  buffer which remains valid only until the next call:
872
873  ``gethostbyaddr``
874
875  ``gethostbyname``
876
877  ``inet_ntoa``
878
879      (``inet_ntop`` is thread-safe, though).
880
881- The RTEMS network package gathers statistics.
882
883- Addition of a mechanism to "tap onto" an interface
884  and monitor every packet received and transmitted.
885
886- Addition of ``SO_SNDWAKEUP`` and ``SO_RCVWAKEUP`` socket options.
887
888Some of the new features are discussed in more detail in the following
889sections.
890
891Network Statistics
892------------------
893
894There are a number of functions to print statistics gathered by
895the network stack.
896These function are declared in ``rtems/rtems_bsdnet.h``.
897
898``rtems_bsdnet_show_if_stats``
899    Display statistics gathered by network interfaces.
900
901``rtems_bsdnet_show_ip_stats``
902    Display IP packet statistics.
903
904``rtems_bsdnet_show_icmp_stats``
905    Display ICMP packet statistics.
906
907``rtems_bsdnet_show_tcp_stats``
908    Display TCP packet statistics.
909
910``rtems_bsdnet_show_udp_stats``
911    Display UDP packet statistics.
912
913``rtems_bsdnet_show_mbuf_stats``
914    Display mbuf statistics.
915
916``rtems_bsdnet_show_inet_routes``
917    Display the routing table.
918
919Tapping Into an Interface
920-------------------------
921
922RTEMS add two new ioctls to the BSD networking code:
923SIOCSIFTAP and SIOCGIFTAP.  These may be used to set and get a*tap function*.  The tap function will be called for every
924Ethernet packet received by the interface.
925
926These are called like other interface ioctls, such as SIOCSIFADDR.
927When setting the tap function with SIOCSIFTAP, set the ifr_tap field
928of the ifreq struct to the tap function.  When retrieving the tap
929function with SIOCGIFTAP, the current tap function will be returned in
930the ifr_tap field.  To stop tapping packets, call SIOCSIFTAP with a
931ifr_tap field of 0.
932
933The tap function is called like this:
934.. code:: c
935
936    int tap (struct ifnet \*, struct ether_header \*, struct mbuf \*)
937
938The tap function should return 1 if the packet was fully handled, in
939which case the caller will simply discard the mbuf.  The tap function
940should return 0 if the packet should be passed up to the higher
941networking layers.
942
943The tap function is called with the network semaphore locked.  It must
944not make any calls on the application levels of the networking level
945itself.  It is safe to call other non-networking RTEMS functions.
946
947Socket Options
948--------------
949
950RTEMS adds two new ``SOL_SOCKET`` level options for ``setsockopt`` and``getsockopt``: ``SO_SNDWAKEUP`` and ``SO_RCVWAKEUP``.  For both, the
951option value should point to a sockwakeup structure.  The sockwakeup
952structure has the following fields:
953.. code:: c
954
955    void    (\*sw_pfn) (struct socket \*, caddr_t);
956    caddr_t sw_arg;
957
958These options are used to set a callback function to be called when, for
959example, there is
960data available from the socket (``SO_RCVWAKEUP``) and when there is space
961available to accept data written to the socket (``SO_SNDWAKEUP``).
962
963If ``setsockopt`` is called with the ``SO_RCVWAKEUP`` option, and the``sw_pfn`` field is not zero, then when there is data
964available to be read from
965the socket, the function pointed to by the ``sw_pfn`` field will be
966called.  A pointer to the socket structure will be passed as the first
967argument to the function.  The ``sw_arg`` field set by the``SO_RCVWAKEUP`` call will be passed as the second argument to the function.
968
969If ``setsockopt`` is called with the ``SO_SNDWAKEUP``
970function, and the ``sw_pfn`` field is not zero, then when
971there is space available to accept data written to the socket,
972the function pointed to by the ``sw_pfn`` field
973will be called.  The arguments passed to the function will be as with``SO_SNDWAKEUP``.
974
975When the function is called, the network semaphore will be locked and
976the callback function runs in the context of the networking task.
977The function must be careful not to call any networking functions.  It
978is OK to call an RTEMS function; for example, it is OK to send an
979RTEMS event.
980
981The purpose of these callback functions is to permit a more efficient
982alternative to the select call when dealing with a large number of
983sockets.
984
985The callbacks are called by the same criteria that the select
986function uses for indicating "ready" sockets. In Stevens *Unix
987Network Programming* on page 153-154 in the section "Under what Conditions
988Is a Descriptor Ready?" you will find the definitive list of conditions
989for readable and writable that also determine when the functions are
990called.
991
992When the number of received bytes equals or exceeds the socket receive
993buffer "low water mark" (default 1 byte) you get a readable callback. If
994there are 100 bytes in the receive buffer and you only read 1, you will
995not immediately get another callback. However, you will get another
996callback after you read the remaining 99 bytes and at least 1 more byte
997arrives. Using a non-blocking socket you should probably read until it
998produces error  EWOULDBLOCK and then allow the readable callback to tell
999you when more data has arrived.  (Condition 1.a.)
1000
1001For sending, when the socket is connected and the free space becomes at
1002or above the "low water mark" for the send buffer (default 4096 bytes)
1003you will receive a writable callback. You don’t get continuous callbacks
1004if you don’t write anything. Using a non-blocking write socket, you can
1005then call write until it returns a value less than the amount of data
1006requested to be sent or it produces error EWOULDBLOCK (indicating buffer
1007full and no longer writable). When this happens you can
1008try the write again, but it is often better to go do other things and
1009let the writable callback tell you when space is available to send
1010again. You only get a writable callback when the free space transitions
1011to above the "low water mark" and not every time you
1012write to a non-full send buffer. (Condition 2.a.)
1013
1014The remaining conditions enumerated by Stevens handle the fact that
1015sockets become readable and/or writable when connects, disconnects and
1016errors occur, not just when data is received or sent. For example, when
1017a server "listening" socket becomes readable it indicates that a client
1018has connected and accept can be called without blocking, not that
1019network data was received (Condition 1.c).
1020
1021Adding an IP Alias
1022------------------
1023
1024The following code snippet adds an IP alias:
1025.. code:: c
1026
1027    void addAlias(const char \*pName, const char \*pAddr, const char \*pMask)
1028    {
1029    struct ifaliasreq      aliasreq;
1030    struct sockaddr_in    \*in;
1031    /* initialize alias request \*/
1032    memset(&aliasreq, 0, sizeof(aliasreq));
1033    sprintf(aliasreq.ifra_name, pName);
1034    /* initialize alias address \*/
1035    in = (struct sockaddr_in \*)&aliasreq.ifra_addr;
1036    in->sin_family = AF_INET;
1037    in->sin_len    = sizeof(aliasreq.ifra_addr);
1038    in->sin_addr.s_addr = inet_addr(pAddr);
1039    /* initialize alias mask \*/
1040    in = (struct sockaddr_in \*)&aliasreq.ifra_mask;
1041    in->sin_family = AF_INET;
1042    in->sin_len    = sizeof(aliasreq.ifra_mask);
1043    in->sin_addr.s_addr = inet_addr(pMask);
1044    /* call to setup the alias \*/
1045    rtems_bsdnet_ifconfig(pName, SIOCAIFADDR, &aliasreq);
1046    }
1047
1048Thanks to `Mike Seirs <mailto:mikes@poliac.com>`_ for this example
1049code.
1050
1051Adding a Default Route
1052----------------------
1053
1054The function provided in this section is functionally equivalent to
1055the command ``route add default gw yyy.yyy.yyy.yyy``:
1056.. code:: c
1057
1058    void mon_ifconfig(int argc, char \*argv[],  unsigned32 command_arg,
1059    bool verbose)
1060    {
1061    struct sockaddr_in  ipaddr;
1062    struct sockaddr_in  dstaddr;
1063    struct sockaddr_in  netmask;
1064    struct sockaddr_in  broadcast;
1065    char               \*iface;
1066    int                 f_ip        = 0;
1067    int                 f_ptp       = 0;
1068    int                 f_netmask   = 0;
1069    int                 f_up        = 0;
1070    int                 f_down      = 0;
1071    int                 f_bcast     = 0;
1072    int                 cur_idx;
1073    int                 rc;
1074    int                 flags;
1075    bzero((void*) &ipaddr, sizeof(ipaddr));
1076    bzero((void*) &dstaddr, sizeof(dstaddr));
1077    bzero((void*) &netmask, sizeof(netmask));
1078    bzero((void*) &broadcast, sizeof(broadcast));
1079    ipaddr.sin_len = sizeof(ipaddr);
1080    ipaddr.sin_family = AF_INET;
1081    dstaddr.sin_len = sizeof(dstaddr);
1082    dstaddr.sin_family = AF_INET;
1083    netmask.sin_len = sizeof(netmask);
1084    netmask.sin_family = AF_INET;
1085    broadcast.sin_len = sizeof(broadcast);
1086    broadcast.sin_family = AF_INET;
1087    cur_idx = 0;
1088    if (argc <= 1) {
1089    /* display all interfaces \*/
1090    iface = NULL;
1091    cur_idx += 1;
1092    } else {
1093    iface = argv[1];
1094    if (isdigit(\*argv[2])) {
1095    if (inet_pton(AF_INET, argv[2], &ipaddr.sin_addr) < 0) {
1096    printf("bad ip address: %s\\n", argv[2]);
1097    return;
1098    }
1099    f_ip = 1;
1100    cur_idx += 3;
1101    } else {
1102    cur_idx += 2;
1103    }
1104    }
1105    if ((f_down !=0) && (f_ip != 0)) {
1106    f_up = 1;
1107    }
1108    while(argc > cur_idx) {
1109    if (strcmp(argv[cur_idx], "up") == 0) {
1110    f_up = 1;
1111    if (f_down != 0) {
1112    printf("Can't make interface up and down\\n");
1113    }
1114    } else if(strcmp(argv[cur_idx], "down") == 0) {
1115    f_down = 1;
1116    if (f_up != 0) {
1117    printf("Can't make interface up and down\\n");
1118    }
1119    } else if(strcmp(argv[cur_idx], "netmask") == 0) {
1120    if ((cur_idx + 1) >= argc) {
1121    printf("No netmask address\\n");
1122    return;
1123    }
1124    if (inet_pton(AF_INET, argv[cur_idx+1], &netmask.sin_addr) < 0) {
1125    printf("bad netmask: %s\\n", argv[cur_idx]);
1126    return;
1127    }
1128    f_netmask = 1;
1129    cur_idx += 1;
1130    } else if(strcmp(argv[cur_idx], "broadcast") == 0) {
1131    if ((cur_idx + 1) >= argc) {
1132    printf("No broadcast address\\n");
1133    return;
1134    }
1135    if (inet_pton(AF_INET, argv[cur_idx+1], &broadcast.sin_addr) < 0) {
1136    printf("bad broadcast: %s\\n", argv[cur_idx]);
1137    return;
1138    }
1139    f_bcast = 1;
1140    cur_idx += 1;
1141    } else if(strcmp(argv[cur_idx], "pointopoint") == 0) {
1142    if ((cur_idx + 1) >= argc) {
1143    printf("No pointopoint address\\n");
1144    return;
1145    }
1146    if (inet_pton(AF_INET, argv[cur_idx+1], &dstaddr.sin_addr) < 0) {
1147    printf("bad pointopoint: %s\\n", argv[cur_idx]);
1148    return;
1149    }
1150    f_ptp = 1;
1151    cur_idx += 1;
1152    } else {
1153    printf("Bad parameter: %s\\n", argv[cur_idx]);
1154    return;
1155    }
1156    cur_idx += 1;
1157    }
1158    printf("ifconfig ");
1159    if (iface != NULL) {
1160    printf("%s ", iface);
1161    if (f_ip != 0) {
1162    char str[256];
1163    inet_ntop(AF_INET, &ipaddr.sin_addr, str, 256);
1164    printf("%s ", str);
1165    }
1166    if (f_netmask != 0) {
1167    char str[256];
1168    inet_ntop(AF_INET, &netmask.sin_addr, str, 256);
1169    printf("netmask %s ", str);
1170    }
1171    if (f_bcast != 0) {
1172    char str[256];
1173    inet_ntop(AF_INET, &broadcast.sin_addr, str, 256);
1174    printf("broadcast %s ", str);
1175    }
1176    if (f_ptp != 0) {
1177    char str[256];
1178    inet_ntop(AF_INET, &dstaddr.sin_addr, str, 256);
1179    printf("pointopoint %s ", str);
1180    }
1181    if (f_up != 0) {
1182    printf("up\\n");
1183    } else if (f_down != 0) {
1184    printf("down\\n");
1185    } else {
1186    printf("\\n");
1187    }
1188    }
1189    if ((iface == NULL) \|| ((f_ip == 0) && (f_down == 0) && (f_up == 0))) {
1190    rtems_bsdnet_show_if_stats();
1191    return;
1192    }
1193    flags = 0;
1194    if (f_netmask) {
1195    rc = rtems_bsdnet_ifconfig(iface, SIOCSIFNETMASK, &netmask);
1196    if (rc < 0) {
1197    printf("Could not set netmask: %s\\n", strerror(errno));
1198    return;
1199    }
1200    }
1201    if (f_bcast) {
1202    rc = rtems_bsdnet_ifconfig(iface, SIOCSIFBRDADDR, &broadcast);
1203    if (rc < 0) {
1204    printf("Could not set broadcast: %s\\n", strerror(errno));
1205    return;
1206    }
1207    }
1208    if (f_ptp) {
1209    rc = rtems_bsdnet_ifconfig(iface, SIOCSIFDSTADDR, &dstaddr);
1210    if (rc < 0) {
1211    printf("Could not set destination address: %s\\n", strerror(errno));
1212    return;
1213    }
1214    flags \|= IFF_POINTOPOINT;
1215    }
1216    /* This must come _after_ setting the netmask, broadcast addresses \*/
1217    if (f_ip) {
1218    rc = rtems_bsdnet_ifconfig(iface, SIOCSIFADDR, &ipaddr);
1219    if (rc < 0) {
1220    printf("Could not set IP address: %s\\n", strerror(errno));
1221    return;
1222    }
1223    }
1224    if (f_up != 0) {
1225    flags \|= IFF_UP;
1226    }
1227    if (f_down != 0) {
1228    printf("Warning: taking interfaces down is not supported\\n");
1229    }
1230    rc = rtems_bsdnet_ifconfig(iface, SIOCSIFFLAGS, &flags);
1231    if (rc < 0) {
1232    printf("Could not set interface flags: %s\\n", strerror(errno));
1233    return;
1234    }
1235    }
1236    void mon_route(int argc, char \*argv[],  unsigned32 command_arg,
1237    bool verbose)
1238    {
1239    int                cmd;
1240    struct sockaddr_in dst;
1241    struct sockaddr_in gw;
1242    struct sockaddr_in netmask;
1243    int                f_host;
1244    int                f_gw       = 0;
1245    int                cur_idx;
1246    int                flags;
1247    int                rc;
1248    memset(&dst, 0, sizeof(dst));
1249    memset(&gw, 0, sizeof(gw));
1250    memset(&netmask, 0, sizeof(netmask));
1251    dst.sin_len = sizeof(dst);
1252    dst.sin_family = AF_INET;
1253    dst.sin_addr.s_addr = inet_addr("0.0.0.0");
1254    gw.sin_len = sizeof(gw);
1255    gw.sin_family = AF_INET;
1256    gw.sin_addr.s_addr = inet_addr("0.0.0.0");
1257    netmask.sin_len = sizeof(netmask);
1258    netmask.sin_family = AF_INET;
1259    netmask.sin_addr.s_addr = inet_addr("255.255.255.0");
1260    if (argc < 2) {
1261    rtems_bsdnet_show_inet_routes();
1262    return;
1263    }
1264    if (strcmp(argv[1], "add") == 0) {
1265    cmd = RTM_ADD;
1266    } else if (strcmp(argv[1], "del") == 0) {
1267    cmd = RTM_DELETE;
1268    } else {
1269    printf("invalid command: %s\\n", argv[1]);
1270    printf("\\tit should be 'add' or 'del'\\n");
1271    return;
1272    }
1273    if (argc < 3) {
1274    printf("not enough arguments\\n");
1275    return;
1276    }
1277    if (strcmp(argv[2], "-host") == 0) {
1278    f_host = 1;
1279    } else if (strcmp(argv[2], "-net") == 0) {
1280    f_host = 0;
1281    } else {
1282    printf("Invalid type: %s\\n", argv[1]);
1283    printf("\\tit should be '-host' or '-net'\\n");
1284    return;
1285    }
1286    if (argc < 4) {
1287    printf("not enough arguments\\n");
1288    return;
1289    }
1290    inet_pton(AF_INET, argv[3], &dst.sin_addr);
1291    cur_idx = 4;
1292    while(cur_idx < argc) {
1293    if (strcmp(argv[cur_idx], "gw") == 0) {
1294    if ((cur_idx +1) >= argc) {
1295    printf("no gateway address\\n");
1296    return;
1297    }
1298    f_gw = 1;
1299    inet_pton(AF_INET, argv[cur_idx + 1], &gw.sin_addr);
1300    cur_idx += 1;
1301    } else if(strcmp(argv[cur_idx], "netmask") == 0) {
1302    if ((cur_idx +1) >= argc) {
1303    printf("no netmask address\\n");
1304    return;
1305    }
1306    f_gw = 1;
1307    inet_pton(AF_INET, argv[cur_idx + 1], &netmask.sin_addr);
1308    cur_idx += 1;
1309    } else {
1310    printf("Unknown argument\\n");
1311    return;
1312    }
1313    cur_idx += 1;
1314    }
1315    flags = RTF_STATIC;
1316    if (f_gw != 0) {
1317    flags \|= RTF_GATEWAY;
1318    }
1319    if (f_host != 0) {
1320    flags \|= RTF_HOST;
1321    }
1322    rc = rtems_bsdnet_rtrequest(cmd, &dst, &gw, &netmask, flags, NULL);
1323    if (rc < 0) {
1324    printf("Error adding route\\n");
1325    }
1326    }
1327
1328Thanks to `Jay Monkman <mailto:jtm@smoothmsmoothie.com>`_ for this example
1329code.
1330
1331Time Synchronization Using NTP
1332------------------------------
1333
1334.. code:: c
1335
1336    int rtems_bsdnet_synchronize_ntp (int interval, rtems_task_priority priority);
1337
1338If the interval argument is 0 the routine synchronizes the RTEMS time-of-day
1339clock with the first NTP server in the rtems_bsdnet_ntpserve array and
1340returns.  The priority argument is ignored.
1341
1342If the interval argument is greater than 0, the routine also starts an
1343RTEMS task at the specified priority and polls the NTP server every
1344‘interval’ seconds.  NOTE: This mode of operation has not yet been
1345implemented.
1346
1347On successful synchronization of the RTEMS time-of-day clock the routine
1348returns 0.  If an error occurs a message is printed and the routine returns -1
1349with an error code in errno.
1350There is no timeout – if there is no response from an NTP server the
1351routine will wait forever.
1352
1353.. COMMENT: Written by Eric Norum
1354
1355.. COMMENT: COPYRIGHT (c) 1988-2002.
1356
1357.. COMMENT: On-Line Applications Research Corporation (OAR).
1358
1359.. COMMENT: All rights reserved.
1360
1361Testing the Driver
1362##################
1363
1364Preliminary Setup
1365=================
1366
1367The network used to test the driver should include at least:
1368
1369- The hardware on which the driver is to run.
1370  It makes testing much easier if you can run a debugger to control
1371  the operation of the target machine.
1372
1373- An Ethernet network analyzer or a workstation with an
1374  ‘Ethernet snoop’ program such as ``ethersnoop`` or``tcpdump``.
1375
1376- A workstation.
1377
1378During early debug, you should consider putting the target, workstation,
1379and snooper on a small network by themselves.  This offers a few
1380advantages:
1381
1382- There is less traffic to look at on the snooper and for the target
1383  to process while bringing the driver up.
1384
1385- Any serious errors will impact only your small network not a building
1386  or campus network.  You want to avoid causing any unnecessary problems.
1387
1388- Test traffic is easier to repeatably generate.
1389
1390- Performance measurements are not impacted by other systems on
1391  the network.
1392
1393Debug Output
1394============
1395
1396There are a number of sources of debug output that can be enabled
1397to aid in tracing the behavior of the network stack.  The following
1398is a list of them:
1399
1400- mbuf activity
1401  There are commented out calls to ``printf`` in the file``sys/mbuf.h`` in the network stack code.  Uncommenting
1402  these lines results in output when mbuf’s are allocated
1403  and freed.  This is very useful for finding memory leaks.
1404
1405- TX and RX queuing
1406  There are commented out calls to ``printf`` in the file``net/if.h`` in the network stack code.  Uncommenting
1407  these lines results in output when packets are placed
1408  on or removed from one of the transmit or receive packet
1409  queues.  These queues can be viewed as the boundary line
1410  between a device driver and the network stack.  If the
1411  network stack is enqueuing packets to be transmitted that
1412  the device driver is not dequeuing, then that is indicative
1413  of a problem in the transmit side of the device driver.
1414  Conversely, if the device driver is enqueueing packets
1415  as it receives them (via a call to ``ether_input``) and
1416  they are not being dequeued by the network stack,
1417  then there is a problem.  This situation would likely indicate
1418  that the network server task is not running.
1419
1420- TCP state transitions
1421  In the unlikely event that one would actually want to see
1422  TCP state transitions, the ``TCPDEBUG`` macro can be defined
1423  in the file ``opt_tcpdebug.h``.  This results in the routine``tcp_trace()`` being called by the network stack and
1424  the state transitions logged into the ``tcp_debug`` data
1425  structure.  If the variable ``tcpconsdebug`` in the file``netinet/tcp_debug.c`` is set to 1, then the state transitions
1426  will also be printed to the console.
1427
1428Monitor Commands
1429================
1430
1431There are a number of command available in the shell / monitor
1432to aid in tracing the behavior of the network stack.  The following
1433is a list of them:
1434
1435- ``inet``
1436  This command shows the current routing information for the TCP/IP stack. Following is an
1437  example showing the output of this command.
1438
1439  .. code:: c
1440
1441      Destination     Gateway/Mask/Hw    Flags     Refs     Use Expire Interface
1442      10.0.0.0        255.0.0.0          U           0        0     17 smc1
1443      127.0.0.1       127.0.0.1          UH          0        0      0 lo0
1444
1445  In this example, there is only one network interface with an IP address of 10.8.1.1.  This
1446  link is currently not up.
1447  Two routes that are shown are the default routes for the Ethernet interface (10.0.0.0) and the
1448  loopback interface (127.0.0.1).
1449  Since the stack comes from BSD, this command is very similar to the netstat command.  For more
1450  details on the network routing please look the following
1451  URL: (http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/network-routing.html)
1452  For a quick reference to the flags, see the table below:
1453
1454  ‘``U``’
1455      Up: The route is active.
1456
1457  ‘``H``’
1458      Host: The route destination is a single host.
1459
1460  ‘``G``’
1461      Gateway: Send anything for this destination on to this remote system, which
1462      will figure out from there where to send it.
1463
1464  ‘``S``’
1465      Static: This route was configured manually, not automatically generated by the
1466      system.
1467
1468  ‘``C``’
1469      Clone: Generates a new route based upon this route for machines we connect
1470      to. This type of route is normally used for local networks.
1471
1472  ‘``W``’
1473      WasCloned: Indicated a route that was auto-configured based upon a local area
1474      network (Clone) route.
1475
1476  ‘``L``’
1477      Link: Route involves references to Ethernet hardware.
1478
1479- ``mbuf``
1480
1481  This command shows the current MBUF statistics.  An example of the command is shown below:
1482
1483  .. code:: c
1484
1485      ************ MBUF STATISTICS \************
1486      mbufs:4096    clusters: 256    free: 241
1487      drops:   0       waits:   0  drains:   0
1488      free:4080          data:16          header:0           socket:0
1489      pcb:0           rtable:0           htable:0           atable:0
1490      soname:0           soopts:0           ftable:0           rights:0
1491      ifaddr:0          control:0          oobdata:0
1492
1493- ``if``
1494
1495  This command shows the current statistics for your Ethernet driver as long as the ioctl hook``SIO_RTEMS_SHOW_STATS`` has been implemented.  Below is an example:
1496
1497  .. code:: c
1498
1499      ************ INTERFACE STATISTICS \************
1500      \***** smc1 \*****
1501      Ethernet Address: 00:12:76:43:34:25
1502      Address:10.8.1.1        Broadcast Address:10.255.255.255  Net mask:255.0.0.0
1503      Flags: Up Broadcast Running Simplex
1504      Send queue limit:50   length:0    Dropped:0
1505      SMC91C111 RTEMS driver A0.01 11/03/2002 Ian Caddy (ianc@microsol.iinet.net.au)
1506      Rx Interrupts:0              Not First:0               Not Last:0
1507      Giant:0                   Runt:0              Non-octet:0
1508      Bad CRC:0                Overrun:0              Collision:0
1509      Tx Interrupts:2               Deferred:0        Missed Hearbeat:0
1510      No Carrier:0       Retransmit Limit:0         Late Collision:0
1511      Underrun:0        Raw output wait:0              Coalesced:0
1512      Coalesce failed:0                Retries:0
1513      \***** lo0 \*****
1514      Address:127.0.0.1       Net mask:255.0.0.0
1515      Flags: Up Loopback Running Multicast
1516      Send queue limit:50   length:0    Dropped:0
1517
1518- ``ip``
1519  This command show the IP statistics for the currently configured interfaces.
1520
1521- ``icmp``
1522  This command show the ICMP statistics for the currently configured interfaces.
1523
1524- ``tcp``
1525  This command show the TCP statistics for the currently configured interfaces.
1526
1527- ``udp``
1528  This command show the UDP statistics for the currently configured interfaces.
1529
1530Driver basic operation
1531======================
1532
1533The network demonstration program ``netdemo`` may be used for these tests.
1534
1535- Edit ``networkconfig.h`` to reflect the values for your network.
1536
1537- Start with ``RTEMS_USE_BOOTP`` not defined.
1538
1539- Edit ``networkconfig.h`` to configure the driver
1540  with an
1541  explicit Ethernet and Internet address and with reception of
1542  broadcast packets disabled:
1543  Verify that the program continues to run once the driver has been attached.
1544
1545- Issue a ‘``u``’ command to send UDP
1546  packets to the ‘discard’ port.
1547  Verify that the packets appear on the network.
1548
1549- Issue a ‘``s``’ command to print the network and driver statistics.
1550
1551- On a workstation, add a static route to the target system.
1552
1553- On that same workstation try to ‘ping’ the target system.
1554  Verify that the ICMP echo request and reply packets appear on the net.
1555
1556- Remove the static route to the target system.
1557  Modify ``networkconfig.h`` to attach the driver
1558  with reception of broadcast packets enabled.
1559  Try to ‘ping’ the target system again.
1560  Verify that ARP request/reply and ICMP echo request/reply packets appear
1561  on the net.
1562
1563- Issue a ‘``t``’ command to send TCP
1564  packets to the ‘discard’ port.
1565  Verify that the packets appear on the network.
1566
1567- Issue a ‘``s``’ command to print the network and driver statistics.
1568
1569- Verify that you can telnet to ports 24742
1570  and 24743 on the target system from one or more
1571  workstations on your network.
1572
1573BOOTP/DHCP operation
1574====================
1575
1576Set up a BOOTP/DHCP server on the network.
1577Set define ``RTEMS USE_BOOT`` in ``networkconfig.h``.
1578Run the ``netdemo`` test program.
1579Verify that the target system configures itself from the BOOTP/DHCP server and
1580that all the above tests succeed.
1581
1582Stress Tests
1583============
1584
1585Once the driver passes the tests described in the previous section it should
1586be subjected to conditions which exercise it more
1587thoroughly and which test its error handling routines.
1588
1589Giant packets
1590-------------
1591
1592- Recompile the driver with ``MAXIMUM_FRAME_SIZE`` set to
1593  a smaller value, say 514.
1594
1595- ‘Ping’ the driver from another workstation and verify
1596  that frames larger than 514 bytes are correctly rejected.
1597
1598- Recompile the driver with ``MAXIMUM_FRAME_SIZE`` restored  to 1518.
1599
1600Resource Exhaustion
1601-------------------
1602
1603- Edit  ``networkconfig.h``
1604  so that the driver is configured with just two receive and transmit descriptors.
1605
1606- Compile and run the ``netdemo`` program.
1607
1608- Verify that the program operates properly and that you can
1609  still telnet to both the ports.
1610
1611- Display the driver statistics (Console ‘``s``’ command or telnet
1612  ‘control-G’ character) and verify that:
1613
1614  # The number of transmit interrupts is non-zero.
1615    This indicates that all transmit descriptors have been in use at some time.
1616
1617  # The number of missed packets is non-zero.
1618    This indicates that all receive descriptors have been in use at some time.
1619
1620Cable Faults
1621------------
1622
1623- Run the ``netdemo`` program.
1624
1625- Issue a ‘``u``’ console command to make the target machine transmit
1626  a bunch of UDP packets.
1627
1628- While the packets are being transmitted, disconnect and reconnect the
1629  network cable.
1630
1631- Display the network statistics and verify that the driver has
1632  detected the loss of carrier.
1633
1634- Verify that you can still telnet to both ports on the target machine.
1635
1636Throughput
1637----------
1638
1639Run the ``ttcp`` network benchmark program.
1640Transfer large amounts of data (100’s of megabytes) to and from the target
1641system.
1642
1643The procedure for testing throughput from a host to an RTEMS target
1644is as follows:
1645
1646# Download and start the ttcp program on the Target.
1647
1648# In response to the ``ttcp`` prompt, enter ``-s -r``.  The
1649  meaning of these flags is described in the ``ttcp.1`` manual page
1650  found in the ``ttcp_orig`` subdirectory.
1651
1652# On the host run ``ttcp -s -t <<insert the hostname or IP address of  the Target here>>``
1653
1654The procedure for testing throughput from an RTEMS target
1655to a Host is as follows:
1656
1657# On the host run ``ttcp -s -r``.
1658
1659# Download and start the ttcp program on the Target.
1660
1661# In response to the ``ttcp`` prompt, enter ``-s -t <<insert  the hostname or IP address of the Target here>>``.  You need to type the
1662  IP address of the host unless your Target is talking to your Domain Name
1663  Server.
1664
1665To change the number of buffers, the buffer size, etc. you just add the
1666extra flags to the ``-t`` machine as specified in the ``ttcp.1``
1667manual page found in the ``ttcp_orig`` subdirectory.
1668
1669.. COMMENT: Text Written by Jake Janovetz
1670
1671.. COMMENT: COPYRIGHT (c) 1988-2002.
1672
1673.. COMMENT: On-Line Applications Research Corporation (OAR).
1674
1675.. COMMENT: All rights reserved.
1676
1677Network Servers
1678###############
1679
1680RTEMS FTP Daemon
1681================
1682
1683The RTEMS FTPD is a complete file transfer protocol (FTP) daemon
1684which can store, retrieve, and manipulate files on the local
1685filesystem.  In addition, the RTEMS FTPD provides “hooks”
1686which are actions performed on received data.  Hooks are useful
1687in situations where a destination file is not necessarily
1688appropriate or in cases when a formal device driver has not yet
1689been implemented.
1690
1691This server was implemented and documented by Jake Janovetz
1692(janovetz@tempest.ece.uiuc.edu).
1693
1694Configuration Parameters
1695------------------------
1696
1697The configuration structure for FTPD is as follows:
1698.. code:: c
1699
1700    struct rtems_ftpd_configuration
1701    {
1702    rtems_task_priority     priority;           /* FTPD task priority  \*/
1703    unsigned long           max_hook_filesize;  /* Maximum buffersize  \*/
1704    /*    for hooks        \*/
1705    int                     port;               /* Well-known port     \*/
1706    struct rtems_ftpd_hook  \*hooks;             /* List of hooks       \*/
1707    };
1708
1709The FTPD task priority is specified with ``priority``.  Because
1710hooks are not saved as files, the received data is placed in an
1711allocated buffer.  ``max_hook_filesize`` specifies the maximum
1712size of this buffer.  Finally, ``hooks`` is a pointer to the
1713configured hooks structure.
1714
1715Initializing FTPD (Starting the daemon)
1716---------------------------------------
1717
1718Starting FTPD is done with a call to ``rtems_initialize_ftpd()``.
1719The configuration structure must be provided in the application
1720source code.  Example hooks structure and configuration structure
1721folllow.
1722.. code:: c
1723
1724    struct rtems_ftpd_hook ftp_hooks[] =
1725    {
1726    {"untar", Untar_FromMemory},
1727    {NULL, NULL}
1728    };
1729    struct rtems_ftpd_configuration rtems_ftpd_configuration =
1730    {
1731    40,                     /* FTPD task priority \*/
1732    512*1024,               /* Maximum hook 'file' size \*/
1733    0,                      /* Use default port \*/
1734    ftp_hooks               /* Local ftp hooks \*/
1735    };
1736
1737Specifying 0 for the well-known port causes FTPD to use the
1738UNIX standard FTPD port (21).
1739
1740Using Hooks
1741-----------
1742
1743In the example above, one hook was installed.  The hook causes
1744FTPD to call the function ``Untar_FromMemory`` when the
1745user sends data to the file ``untar``.  The prototype for
1746the ``untar`` hook (and hooks, in general) is:
1747.. code:: c
1748
1749    int Untar_FromMemory(unsigned char \*tar_buf, unsigned long size);
1750
1751An example FTP transcript which exercises this hook is:
1752.. code:: c
1753
1754    220 RTEMS FTP server (Version 1.0-JWJ) ready.
1755    Name (dcomm0:janovetz): John Galt
1756    230 User logged in.
1757    Remote system type is RTEMS.
1758    ftp> bin
1759    200 Type set to I.
1760    ftp> dir
1761    200 PORT command successful.
1762    150 ASCII data connection for LIST.
1763    drwxrwx--x      0     0         268  dev
1764    drwxrwx--x      0     0           0  TFTP
1765    226 Transfer complete.
1766    ftp> put html.tar untar
1767    local: html.tar remote: untar
1768    200 PORT command successful.
1769    150 BINARY data connection.
1770    210 File transferred successfully.
1771    471040 bytes sent in 0.48 secs (9.6e+02 Kbytes/sec)
1772    ftp> dir
1773    200 PORT command successful.
1774    150 ASCII data connection for LIST.
1775    drwxrwx--x      0     0         268  dev
1776    drwxrwx--x      0     0           0  TFTP
1777    drwxrwx--x      0     0        3484  public_html
1778    226 Transfer complete.
1779    ftp> quit
1780    221 Goodbye.
1781
1782.. COMMENT: RTEMS Remote Debugger Server Specifications
1783
1784.. COMMENT: Written by: Emmanuel Raguet <raguet@crf.canon.fr>
1785
1786DEC 21140 Driver
1787################
1788
1789DEC 21240 Driver Introduction
1790=============================
1791
1792.. COMMENT: XXX add back in cross reference to list of boards.
1793
1794One aim of our project is to port RTEMS on a standard PowerPC platform.
1795To achieve it, we have chosen a Motorola MCP750 board. This board includes
1796an Ethernet controller based on a DEC21140 chip. Because RTEMS has a
1797TCP/IP stack, we will
1798have to develop the DEC21140 related ethernet driver for the PowerPC port of
1799RTEMS. As this controller is able to support 100Mbps network and as there is
1800a lot of PCI card using this DEC chip, we have decided to first
1801implement this driver on an Intel PC386 target to provide a solution for using
1802RTEMS on PC with the 100Mbps network and then to port this code on PowerPC in
1803a second phase.
1804
1805The aim of this document is to give some PCI board generalities and
1806to explain the software architecture of the RTEMS driver. Finally, we will see
1807what will be done for ChorusOs and Netboot environment .
1808
1809Document Revision History
1810=========================
1811
1812*Current release*:
1813
1814- Current applicable release is 1.0.
1815
1816*Existing releases*:
1817
1818- 1.0 : Released the 10/02/98. First version of this document.
1819
1820- 0.1 : First draft of this document
1821
1822*Planned releases*:
1823
1824- None planned today.
1825
1826DEC21140 PCI Board Generalities
1827===============================
1828
1829.. COMMENT: XXX add crossreference to PCI Register Figure
1830
1831This chapter describes rapidely the PCI interface of this Ethernet controller.
1832The board we have chosen for our PC386 implementation is a D-Link DFE-500TX.
1833This is a dual-speed 10/100Mbps Ethernet PCI adapter with a DEC21140AF chip.
1834Like other PCI devices, this board has a PCI device’s header containing some
1835required configuration registers, as shown in the PCI Register Figure.
1836By reading
1837or writing these registers, a driver can obtain information about the type of
1838the board, the interrupt it uses, the mapping of the chip specific registers, ...
1839
1840On Intel target, the chip specific registers can be accessed via 2
1841methods : I/O port access or PCI address mapped access. We have chosen to implement
1842the PCI address access to obtain compatible source code to the port the driver
1843on a PowerPC target.
1844
1845.. COMMENT: PCI Device's Configuration Header Space Format
1846
1847
1848.. image:: images/PCIreg.jpg
1849
1850
1851.. COMMENT: XXX add crossreference to PCI Register Figure
1852
1853On RTEMS, a PCI API exists. We have used it to configure the board. After initializing
1854this PCI module via the ``pci_initialize()`` function, we try to detect
1855the DEC21140 based ethernet board. This board is characterized by its Vendor
1856ID (0x1011) and its Device ID (0x0009). We give these arguments to the``pcib_find_by_deviceid``
1857function which returns , if the device is present, a pointer to the configuration
1858header space (see PCI Registers Fgure). Once this operation performed,
1859the driver
1860is able to extract the information it needs to configure the board internal
1861registers, like the interrupt line, the base address,... The board internal
1862registers will not be detailled here. You can find them in *DIGITAL
1863Semiconductor 21140A PCI Fast Ethernet LAN Controller
1864- Hardware Reference Manual*.
1865
1866.. COMMENT: fix citation
1867
1868RTEMS Driver Software Architecture
1869==================================
1870
1871In this chapter will see the initialization phase, how the controller uses the
1872host memory and the 2 threads launched at the initialization time.
1873
1874Initialization phase
1875--------------------
1876
1877The DEC21140 Ethernet driver keeps the same software architecture than the other
1878RTEMS ethernet drivers. The only API the programmer can use is the ``rtems_dec21140_driver_attach````(struct rtems_bsdnet_ifconfig \*config)`` function which
1879detects the board and initializes the associated data structure (with registers
1880base address, entry points to low-level initialization function,...), if the
1881board is found.
1882
1883Once the attach function executed, the driver initializes the DEC
1884chip. Then the driver connects an interrupt handler to the interrupt line driven
1885by the Ethernet controller (the only interrupt which will be treated is the
1886receive interrupt) and launches 2 threads : a receiver thread and a transmitter
1887thread. Then the driver waits for incoming frame to give to the protocol stack
1888or outcoming frame to send on the physical link.
1889
1890Memory Buffer
1891-------------
1892
1893.. COMMENT: XXX add cross reference to Problem
1894
1895This DEC chip uses the host memory to store the incoming Ethernet frames and
1896the descriptor of these frames. We have chosen to use 7 receive buffers and
18971 transmit buffer to optimize memory allocation due to cache and paging problem
1898that will be explained in the section *Encountered Problems*.
1899
1900To reference these buffers to the DEC chip we use a buffer descriptors
1901ring. The descriptor structure is defined in the Buffer Descriptor Figure.
1902Each descriptor
1903can reference one or two memory buffers. We choose to use only one buffer of
19041520 bytes per descriptor.
1905
1906The difference between a receive and a transmit buffer descriptor
1907is located in the status and control bits fields. We do not give details here,
1908please refer to the \[DEC21140 Hardware Manual].
1909
1910.. COMMENT: Buffer Descriptor
1911
1912
1913.. image:: images/recvbd.jpg
1914
1915
1916Receiver Thread
1917---------------
1918
1919This thread is event driven. Each time a DEC PCI board interrupt occurs, the
1920handler checks if this is a receive interrupt and send an event “reception”
1921to the receiver thread which looks into the entire buffer descriptors ring the
1922ones that contain a valid incoming frame (bit OWN=0 means descriptor belongs
1923to host processor). Each valid incoming ethernet frame is sent to the protocol
1924stack and the buffer descriptor is given back to the DEC board (the host processor
1925reset bit OWN, which means descriptor belongs to 21140).
1926
1927Transmitter Thread
1928------------------
1929
1930This thread is also event driven. Each time an Ethernet frame is put in the
1931transmit queue, an event is sent to the transmit thread, which empty the queue
1932by sending each outcoming frame. Because we use only one transmit buffer, we
1933are sure that the frame is well-sent before sending the next.
1934
1935Encountered Problems
1936====================
1937
1938On Intel PC386 target, we were faced with a problem of memory cache management.
1939Because the DEC chip uses the host memory to store the incoming frame and because
1940the DEC21140 configuration registers are mapped into the PCI address space,
1941we must ensure that the data read (or written) by the host processor are the
1942ones written (or read) by the DEC21140 device in the host memory and not old
1943data stored in the cache memory. Therefore, we had to provide a way to manage
1944the cache. This module is described in the document *RTEMS
1945Cache Management For Intel*. On Intel, the
1946memory region cache management is available only if the paging unit is enabled.
1947We have used this paging mechanism, with 4Kb page. All the buffers allocated
1948to store the incoming or outcoming frames, buffer descriptor and also the PCI
1949address space of the DEC board are located in a memory space with cache disable.
1950
1951Concerning the buffers and their descriptors, we have tried to optimize
1952the memory space in term of allocated page. One buffer has 1520 bytes, one descriptor
1953has 16 bytes. We have 7 receive buffers and 1 transmit buffer, and for each,
19541 descriptor : (7+1)*(1520+16) = 12288 bytes = 12Kb = 3 entire pages. This
1955allows not to lose too much memory or not to disable cache memory for a page
1956which contains other data than buffer, which could decrease performance.
1957
1958ChorusOs DEC Driver
1959===================
1960
1961Because ChorusOs is used in several Canon CRF projects, we must provide such
1962a driver on this OS to ensure compatibility between the RTEMS and ChorusOs developments.
1963On ChorusOs, a DEC driver source code already exists but only for a PowerPC
1964target. We plan to port this code (which uses ChorusOs API) on Intel target.
1965This will allow us to have homogeneous developments. Moreover, the port of the
1966development performed with ChorusOs environment to RTEMS environment will be
1967easier for the developers.
1968
1969Netboot DEC driver
1970==================
1971
1972We use Netboot tool to load our development from a server to the target via
1973an ethernet network. Currently, this tool does not support the DEC board. We
1974plan to port the DEC driver for the Netboot tool.
1975
1976But concerning the port of the DEC driver into Netboot, we are faced
1977with a problem : in RTEMS environment, the DEC driver is interrupt or event
1978driven, in Netboot environment, it must be used in polling mode. It means that
1979we will have to re-write some mechanisms of this driver.
1980
1981List of Ethernet cards using the DEC chip
1982=========================================
1983
1984Many Ethernet adapter cards use the Tulip chip. Here is a non exhaustive list
1985of adapters which support this driver :
1986
1987- Accton EtherDuo PCI.
1988
1989- Accton EN1207 All three media types supported.
1990
1991- Adaptec ANA6911/TX 21140-AC.
1992
1993- Cogent EM110 21140-A with DP83840 N-Way MII transceiver.
1994
1995- Cogent EM400 EM100 with 4 21140 100mbps-only ports + PCI Bridge.
1996
1997- Danpex EN-9400P3.
1998
1999- D-Link DFE500-Tx 21140-A with DP83840 transceiver.
2000
2001- Kingston EtherX KNE100TX 21140AE.
2002
2003- Netgear FX310 TX 10/100 21140AE.
2004
2005- SMC EtherPower10/100 With DEC21140 and 68836 SYM transceiver.
2006
2007- SMC EtherPower10/100 With DEC21140-AC and DP83840 MII transceiver.
2008  Note: The EtherPower II uses the EPIC chip, which requires a different driver.
2009
2010- Surecom EP-320X DEC 21140.
2011
2012- Thomas Conrad TC5048.
2013
2014- Znyx ZX345 21140-A, usually with the DP83840 N-Way MII transciever. Some ZX345
2015  cards made in 1996 have an ICS 1890 transciver instead.
2016
2017- ZNYX ZX348 Two 21140-A chips using ICS 1890 transcievers and either a 21052
2018  or 21152 bridge. Early versions used National 83840 transcievers, but later
2019  versions are depopulated ZX346 boards.
2020
2021- ZNYX ZX351 21140 chip with a Broadcom 100BaseT4 transciever.
2022
2023Our DEC driver has not been tested with all these cards, only with the D-Link
2024DFE500-TX.
2025
2026- *[DEC21140 Hardware Manual] DIGITAL, *DIGITAL
2027  Semiconductor 21140A PCI Fast Ethernet LAN Controller - Hardware
2028  Reference Manual**.
2029
2030- *[99.TA.0021.M.ER]Emmanuel Raguet,*RTEMS Cache Management For Intel**.
2031
2032Command and Variable Index
2033##########################
2034
2035There are currently no Command and Variable Index entries.
2036
2037.. COMMENT: @printindex fn
2038
2039Concept Index
2040#############
2041
2042There are currently no Concept Index entries.
2043
2044.. COMMENT: @printindex cp
Note: See TracBrowser for help on using the repository browser.