GROS ( G ROS ( G ROS IS IS A R OUTING R OUTING O PERATING O PERATING S YSTEM ) Phase II Batch : 6 Guide :Sabitha. S Hemant Pillai Dean John Abraham Krishnakumar.R
An Overview Review of previous stage.Review of previous stage. Fast Ethernet card reception and transmission.Fast Ethernet card reception and transmission. Transfer of packets from one network to another.Transfer of packets from one network to another. Equalizing the priority of cards.Equalizing the priority of cards. Bug yet to be solvedBug yet to be solved
Review of previous stage Booting.Booting. Protected mode switching.Protected mode switching. Reception and transmission of packets using PCI and ISA cards.Reception and transmission of packets using PCI and ISA cards.
Preliminaries Speed of network cardsSpeed of network cards Ordinary – 10Mbps Ordinary – 10Mbps Fast - 100Mbps Fast - 100Mbps Gigabit Ethernets – 1000Mbps Gigabit Ethernets – 1000Mbps We use Fast Ethernet cards, 100MbpsWe use Fast Ethernet cards, 100Mbps Hubs are of 10MbpsHubs are of 10Mbps So Uses Auto-negotiationSo Uses Auto-negotiation
Auto-Negotiation Checks the ability of the partner.Checks the ability of the partner. Selects the common, maximum possible speed.Selects the common, maximum possible speed. Done by the transceiver on the card.Done by the transceiver on the card. In our case it is REALTEK’s 8139 chipset.In our case it is REALTEK’s 8139 chipset.
Fast Ethernet cards GROS function pci_bios gets us the base address of the card.GROS function pci_bios gets us the base address of the card. Situation demands two cardsSituation demands two cards Had to search Bus no 0 and 1 to find the address of both n/w cardsHad to search Bus no 0 and 1 to find the address of both n/w cards Hardware address can be got as in case of Ordinary cards (Read from PROM).Hardware address can be got as in case of Ordinary cards (Read from PROM). Done when initializing the card. Done when initializing the card. Transmission differentTransmission different
Environment Two networksTwo networks Can be heterogeneous networks with different OS’es running over IP.Can be heterogeneous networks with different OS’es running over IP. A single machine with GROS, connected to two networksA single machine with GROS, connected to two networks The machine has two Fast Ethernet cards.The machine has two Fast Ethernet cards.
The Plan network1 network2 System with GROS check Case 1 : Packet from networ1 to network2 Case 2 : Packet from network 2 to network 1
The Network card class ne ne, Object used for network card management.ne, Object used for network card management. Presently it has only one method, init.Presently it has only one method, init. Declared In file ne.h.Declared In file ne.h. Next slides, code is being explained.... represents few lines of codeNext slides, code is being explained.... represents few lines of code
The code for ne class ne { class ne { public: public: unsigned int *rx_ring; unsigned int *rx_ring; void init(int notFirInit, void init(int notFirInit, int ioAd); }
rx_ring - is the reception ring.rx_ring - is the reception ring. void ne::init(int notFirInit,void ne::init(int notFirInit, int ioAd){ if (!notFirInit) { /* Get hw address*/ /* Print it */ } Highlights of ne
/* Bring chip to low power mode */ outb(0xC0, ioAd + CFG9346); outb(0x03, ioAd + CONFIG1); outb(0x03, ioAd + CONFIG1); outb('H‘, ioAd + HLTCLK); outb('H‘, ioAd + HLTCLK); /* Reset the chip */ outb(CMDRESET, ioAd + CHIPCMD); for (i = 1000 ; i > 0 ; i-- ) for (i = 1000 ; i > 0 ; i-- ) if ((inb(ioAd + CHIPCMD) & CMDRESET) == 0) if ((inb(ioAd + CHIPCMD) & CMDRESET) == 0) break; break;... Fixup up the Max DMA Burst and duplex mode... outl((unsigned long)rx_ring, ioAd + outl((unsigned long)rx_ring, ioAd + RXBUF); RXBUF);
.. Put the card to promiscous mode.... Enable the transmission..... Enable the transmission..... Enable interrupts..... Enable interrupts...} Using this classUsing this class we declare : ne *n=(ne *) 0x5000; we declare : ne *n=(ne *) 0x5000; Receive ring is initialized in the fn. Receive ring is initialized in the fn. ‘newmain’ as ‘newmain’ as n->rx_ring=(unsigned int*)0x8000 n->rx_ring=(unsigned int*)0x8000 n->init(0, ioAd1) n->init(0, ioAd1) n->init(0, ioAd2) n->init(0, ioAd2) (ioAd1 and ioAd2 got by function pci_bios ) (ioAd1 and ioAd2 got by function pci_bios )
enable_irq() function enables the irq’s ofenable_irq() function enables the irq’s of keyboard and the two n/w cards. Two function are registered :Two function are registered : net1() as ISR of n/w card 1 net1() as ISR of n/w card 1 net2() as ISR of n/w card 2 net2() as ISR of n/w card 2 Both functions call common function : Both functions call common function : net(addr1,addr2) net(addr1,addr2) net1 calls with ioAd1 and ioAd2 net1 calls with ioAd1 and ioAd2 net2 with ioAd2 and ioAd1 as parameters net2 with ioAd2 and ioAd1 as parametersInterrupts
Both the card receives to n->rx_ring one at a time.Both the card receives to n->rx_ring one at a time. After a single reception :After a single reception : 112 status n->rx_ring next size Size = header + pckt length rest of pckt Reception
Put the address of packet to be transmittedPut the address of packet to be transmitted to Transmit address register to Transmit address register outl((unsigned int)(n->rx_ring+4),,ioAd2+TXADDR0); outl((unsigned int)(n->rx_ring+4),,ioAd2+TXADDR0); Tell the network card to transmit itTell the network card to transmit it outl(0xffffdfff & (myflag| ((unsigned int)hdr.h.count-4)) ((unsigned int)hdr.h.count-4)),ioAd2+TXSTATUS0);,ioAd2+TXSTATUS0); High lights of Transmission
Usual drivers use upto 4 xmit buffersUsual drivers use upto 4 xmit buffers When transmit success, interrupt raisedWhen transmit success, interrupt raised Buffer marked as freeBuffer marked as free Here only one buffer used.Here only one buffer used. Wait until a single packet is transmittedWait until a single packet is transmittedwhile(!(inl(ioAd2+TXSTATUS0)&0x )){ times++; times++; if (times == 100) break; } The difference
Traffic of one side greater then always the card of that side gets serviced(if it has low irq no.)Traffic of one side greater then always the card of that side gets serviced(if it has low irq no.) The trouble is with 8259 Interrupt controllerThe trouble is with 8259 Interrupt controller After an interrupt is serviced, its priority is made lowest. Hence all equalAfter an interrupt is serviced, its priority is made lowest. Hence all equal /* The code below equilizes the */ /* The code below equilizes the */ /* priority of all IRQ's D7=R=1 */ /* priority of all IRQ's D7=R=1 */ /* and D5=S=1 */ outb(0xa0,0x20);outb(0xa0,0xa0); The Bug
Transmitted packets from machine in one n/wTransmitted packets from machine in one n/w to a machine in other n/w In the other n/w we checked using TCPDUMPIn the other n/w we checked using TCPDUMP PING, TELNET and other tools does workPING, TELNET and other tools does work Tried changing the ip address when the packet was within GROS. SuccededTried changing the ip address when the packet was within GROS. SuccededChecking
GROS crashes when no of packets reach 2400 rangeGROS crashes when no of packets reach 2400 range First Observed when :First Observed when : - LINUX NFS client m/c on one n/w - LINUX NFS client m/c on one n/w - Server on another n/w - Server on another n/w - Ran X windows - Ran X windows - Desktop was being transmitted crashed. - Desktop was being transmitted crashed. Verified packet nos by using the broadcast option of PING and TCPDUMP.Verified packet nos by using the broadcast option of PING and TCPDUMP. Changed stack location without success.Changed stack location without success. Bug yet to be solved
Fast Ethernet card FunctionalityFast Ethernet card Functionality Getting packet from one n/w to anotherGetting packet from one n/w to another IRQ priority problemIRQ priority problem CheckingChecking The remaining BugThe remaining BugSummary
Thank You