CIS 677 LAB III: Ethernet. Media Access Control
Due on Fr, May 29, 1998, In class

1 Goals

2 Layered architecture

For the purpose of this lab, assume that each node in the network has three layers: physical layer, datalink layer (DLC), and application layer. Datalink layer (DLC) is composed of the media access control sublayer and the logical link sublayer (Figure 1). The nodes in the network are connected via a bus. Each layer in a node can be thought of as an abstract entity that performs certain functions.



Figure 1Layered Architecture

3 Protocol Data Units

Each layer communicates through Protocol Data Units (PDU). The application layer PDU is called A PDU, the DLC PDU is called D_PDU, and the physical layer PDU is called PH_PDU. The A_PDU, D PDU and PH_PDU formats are defined below. These definitions, together with some others are provided to you in the file pdu.h .

 typedef struct {          int  snode;                    /* source node address      */          int  dnode;                    /* destination node address */          char data[DATASIZE];           /* data                     */  } A_PDU_TYPE;    typedef struct {          int               curr_node;   /* address of this node     */          int               next_node;   /* address of next node     */          A_PDU_TYPE        a_pdu;       /* application pdu          */          enum boolean      error;  } D_PDU_TYPE;    typedef struct {          int               type;          D_PDU_TYPE        d_pdu;       /* dlc  pdu          */  } PH_PDU_TYPE;    typedef struct {          union {                               /* structure containing a_pdu */                  A_PDU_TYPE        a_pdu;      /* d_pdu or ph_pdu as a union */                  D_PDU_TYPE        d_pdu;                  PH_PDU_TYPE       ph_pdu;          } u;          int type;  /* One of: TYPE_IS_A_PDU, TYPE_IS_D_PDU, TYPE_IS_PH_PDU */  } PDU_TYPE;    You will need the followigs variable in your function.    #define ATTEMPLIMIT 16     /* Maximum number of retransmission attempts */  #define time_slot 51200.0  /* Time in nanoseconds to transmit 512 bit on a 10 Mbps */    typedef struct{         ..........    int numb_of_coll_per_frame;  /* number of current collision occurred to a frame*/  int max_numb_of_coll_per_frame; /* number of all the collisions occurred to a frame */  int tot_numb_of_coll_per_node; /* total number of collisions occurred to */                                  /* all the frames transmitted by this node*/    } Data_Link_Connectiont;        

The application layer sends an a_pdu to the DLC layer. The DLC layer receives this a_pdu and encapsulates it within a d_pdu. It then performs its functions on the d_pdu and sends the d_pdu to the physical layer. In the same manner, the physical layer receives the d_pdu, encapsulates it within a ph_pdu and sends it to the link entity. The link entity receives a ph_pdu from one physical layer and delivers it to the physical layer at the other end. When a physical layer receives a ph_pdu from the link, it extracts the d_pdu from it and sends it to the dlc layer. The dlc layer checks the d_pdu for errors, extracts the a_pdu and sends it to the application layer.

4 Media Access Control

Under the IEEE 802 series of standards, the data link layer of the OSI Reference Model is subdivided into two sublayers: Logical Link Control (LLC) and the Medium Access Control (MAC). The MAC sublayer is responsible for checking the channel and transmitting data if the channel is idle, cheking for occurrence of a collision, and taking a series of predefined steps if a collision is detected. The MAC layer is an interface between user data and the physical placement and retrieval of data on the network. In our lab we will focus more on one of major functions performed by the MAC sublayer: transmission medium access management. The activities associated with this function are:

5 Transmission Media Access Management

CSMA/CD can be described as a listen-before-acting access method. Thus, the first function associated with transmission media access management is to find out whether any data is already being transmitted on the network and, if so, to defer transmission. During the listening process, each station attempts to sense the carrier signal on the bus, hence the name carrier sense (CS) is used for this access method.

5.1 Collision Detection

Under Manchester encoding, a transition occurs at the middle of each bit period. Also a binary 1 is represented by a high-to-low transition, while a binaty 0 is represented by a low-to-high voltage transition. Thus, an examination of the voltage on the medium of a base-band network enables a station to determine whether a carrier is present. If a carrier signal is found, the station with data to transmit will continue to monitor the channel. When the current transmission ends, the station will then transmit its data, while checking the channel for collisions. Since Ethernet and IEEE 802.3 Manchester encoded signals have a 1 volt average DC voltage level, a collision results at an average DC level of 2 volts. Thus, a tranceiver or network interface card can detect collision by monitoring the voltage level of the Manchester line signal.

5.2 Jam Pattern

If a collision is detected during transmission, the transmitting station will cease transmitting of data and initiate transmitting of a jam pattern. The jam pattern consists of 32 to 48 bits. These bits can have any value other than the CRC value that corresponds to the partial frame transmitted before the jam. The transmission of the jam pattern ensures that the collision lasts long enough to be detected by all stations on the network.

5.3 Collision backoff and retransmission

Once a collision is detected, the transmitting station waits a random number of time slots before attempting to retransmit. The term "time slot" represents 512 bits on a 10-Mbps network. The actual number of slot times the station waits is selected by a randomization process, formaly known as truncated binary exponential backoff. Under this randomization process, a randomly selected integer r defines the number of slot times the station waits before listening to determinate whether the channel is clear. At the selected slot, the station begins to retransmit the frame, while listening for another collision. The number of time slots to delay before the n-th retransmission attempt is chosen as a uniformly distributed random integer r in the range between 0 and 2k , where k=min(n,10). After a user-defined maximum number of attempts, the MAC entity assumes that some problem exists, gives up, and reports failure to LLC.

5.4 Waiting time

If the cable is busy, the station waits until it goes idle; otherwise it transmits immediately. If two or more stations simultaneously begin transmitting on an idle cable, they will collide. All colliding stations then terminate their transmission, wait a random time, and repeat the whole process all over again.

6 Function description

In this lab you are going to implement the collision backoff and retransmission function.

cn collision_detect(Data_Link_Connectiont *mac_layer).

This function will be based on the algorithm explained in Section 5.3.

Here there are the explanations for some variables and functions you may use (in addition to those described in Section 3).

Data_Link_Connectiont *mac_layer /* This is a pointer to the data structure of MAC layer */

int min(int a, int b) /* Returns the minimum of a and b */

float ran_numb() /* Returns a uniformely distributed random float in the range 0 to 1 */

retransmit(mac_layer, int delay) /* Call this function to retransmit */

Your code should calculate the variable delay, which gives in nanoaseconds the retransmission time and it should be a multipler of time_slot interval.



Figure 2Three Node Configuration

7 Methodology

In this lab, you will design the cn_collision_detect function. for the mac sublayer.

  1. In directory /usr/class/cis677/Lab3/Files/, you can find these files:

  2. Copy the above files to your directory.
  3. Experiment with enet_demo. See section 8 for instructions on how to run your program.
  4. Part 1: Aswer the following questions using enet_demo:
    1. What happens after the station has detected a collision ?
    2. Why must the station continue to transmit for some time even after the collision detection ?
    3. What is the purpose of the minimum frame size? What is its implication with the network segment size ?

  5. Part 2 Study the source code files carefully. (don't worry about the config file).
  6. Now you are ready to write your program for the mac sublayer. All you have to do in this lab is fill in the appropriate code for cn_collision_detect() in physical_layer.c(don't worry about name of this file. In this lab it represents the mac sublayer).
  7. To compile your program, type make. This will produce an executable called lab3_exec in your working directory.
  8. Now execute your version of the code and use the configuration file to make sure it works.
  9. Your code should produce some statistics about collisions. So you have to calculate the total number of collisions per node and the maximum number of collisions per frame for each node. In the outline there are directions on how to produce these statistics. You must submit hard copies of these statistics.

8 Running your program: The Graphical User Interface

Login to an HP machine. NOTE: This program works only on HP machines. At your unix prompt, type enet_demo. A window with the simulator interface will open on your terminal.

Figure 2 shows the the 3-nodes configuration bus. Each node has 3 layers denoted by three squares. All the three nodes are connected to the same bus.

The top of the main simulator window has a menu bar that has the following selections.






Menu
Submenu
Description



File
Load
Load config file
Exit
Stop the program and exit



Edit
Raise
Raise the node graphs and space-time diagrams
to the front of main window. Useful when you cannot see the
graphs.



Run
Run
Start the simulator. You need to send msg/graph
to see further animation.
Single Step
Enters single step mode. Use the space bar for a step.
Pause
Pause the simulation.
Resume
Resume the simulation.
Delay
Set delay between events. The default is 50. 5 is pretty fast.
Stop Time
The simulation time to stop.
Inc/Dec Debug Level
Increament/Decrement Debug Level, which is used in dprintf().



Help
About
About the CISE Project.
How to use
Help text.



9 Submissions

You must submit hard copies of the following:

10 Miscellaneous Notes

If you have any questions, please send an e-mail to durresi@cis.ohio-state.edu