GROS ( G ROS ( G ROS IS IS A R OUTING R OUTING O PERATING O PERATING S YSTEM ) Phase II Batch : 6...
-
Upload
lillian-welch -
Category
Documents
-
view
215 -
download
0
Transcript of GROS ( G ROS ( G ROS IS IS A R OUTING R OUTING O PERATING O PERATING S YSTEM ) Phase II Batch : 6...
GROSGROS((GGROS ISROS IS AA R ROUTINGOUTING O OPERATING PERATING SSYSTEMYSTEM))
Phase IIPhase II Batch : 6 Batch : 6
Guide :Sabitha . SGuide :Sabitha . S
Hemant PillaiHemant PillaiDean John AbrahamDean John Abraham
Krishnakumar.RKrishnakumar.R
An Overview An Overview
• Review of previous stage.Review of previous stage.
• Fast Ethernet card reception and Fast Ethernet card reception and transmission.transmission.
• Transfer of packets from one network to Transfer of packets from one network to another. another.
• Equalizing the priority of cards. Equalizing the priority of cards.
• Bug yet to be solvedBug yet to be solved
Review of previous stageReview of previous stage
• Booting.Booting.
• Protected mode switching.Protected mode switching.
• Reception and transmission of packets Reception and transmission of packets using PCI and ISA cards.using PCI and ISA cards.
PreliminariesPreliminaries
• Speed of network cardsSpeed of network cards
Ordinary – 10MbpsOrdinary – 10Mbps
Fast - 100MbpsFast - 100Mbps
Gigabit Ethernets – 1000MbpsGigabit 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-NegotiationAuto-Negotiation
• Checks the ability of the partner.Checks the ability of the partner.
• Selects the common, maximum possible Selects the common, maximum possible speed.speed.
• Done by the transceiver on the card.Done by the transceiver on the card.
• In our case it is REALTEK’s 8139 In our case it is REALTEK’s 8139 chipset .chipset .
Fast Ethernet cardsFast Ethernet cards
• GROS function GROS function pci_biospci_bios gets us the gets us the base address of the card.base address of the card.
• Situation demands two cardsSituation demands two cards• Had to search Bus no 0 and 1 to find the Had to search Bus no 0 and 1 to find the
address of both n/w cardsaddress of both n/w cards• Hardware address can be got as in case Hardware address can be got as in case
of Ordinary cards (Read from PROM).of Ordinary cards (Read from PROM).• Done when initializing the card.Done when initializing the card.• Transmission differentTransmission different
EnvironmentEnvironment
• Two networksTwo networks
• Can be heterogeneous networks with Can be heterogeneous networks with different OS’es running over IP.different OS’es running over IP.
• A single machine with GROS, connected A single machine with GROS, connected to two networksto two networks
• The machine has two Fast Ethernet The machine has two Fast Ethernet cards. cards.
The PlanThe Plan
network1 network2
System with GROS
check
Case 1 : Packet Case 1 : Packet from networ1 to from networ1 to network2network2
Case 2 : Packet Case 2 : Packet from network 2 from network 2 to network 1to network 1
The Network card class The Network card class nene
• nene , Object used for network card , Object used for network card management.management.
• Presently it has only one method, Presently it has only one method, init.init.• Declared In file ne.h. Declared In file ne.h.
• Next slides, code is being explained Next slides, code is being explained . . . . represents few lines of code . . . . represents few lines of code
The code for The code for nene
class ne {class ne {
public:public:
unsigned int *rx_ring;unsigned int *rx_ring;
void init(int notFirInit,void init(int notFirInit,
int ioAd);int ioAd);
}}
• rx_ring - rx_ring - is the reception ring.is the reception ring.• void ne::init(int notFirInit,void ne::init(int notFirInit,
int ioAd){int ioAd){
....................
if (!notFirInit) {if (!notFirInit) {
/* Get hw address*//* Get hw address*/
/* Print it *//* Print it */
. . . . . . . . . . . . . .
}}
Highlights of Highlights of nene
/* Bring chip to low power mode *//* Bring chip to low power mode */
outb(0xC0, ioAd + CFG9346); outb(0xC0, ioAd + CFG9346); outb(0x03, ioAd + CONFIG1);outb(0x03, ioAd + CONFIG1); outb('H‘, ioAd + HLTCLK); outb('H‘, ioAd + HLTCLK);
/* Reset the chip *//* Reset the chip */ outb(CMDRESET, ioAd + outb(CMDRESET, ioAd + CHIPCMD);CHIPCMD);
for (i = 1000 ; i > 0 ; i-- )for (i = 1000 ; i > 0 ; i-- ) if ((inb(ioAd + CHIPCMD) & if ((inb(ioAd + CHIPCMD) &
CMDRESET) == CMDRESET) == 0)0)
break;break;. . . Fixup up the Max DMA . . .. . . Fixup up the Max DMA . . .. . . Burst and duplex mode . . . . . . Burst and duplex mode . . .
outl((unsigned long)rx_ring, ioAd +outl((unsigned long)rx_ring, ioAd + RXBUF);RXBUF);
. . Put the card to promiscous mode . .. . Put the card to promiscous mode . .
. . Enable the transmission . . .. . Enable the transmission . . .
. . Enable interrupts . . .. . Enable interrupts . . .
}}
• Using this classUsing this class
we declare : we declare : ne *n=(ne *) 0x5000;ne *n=(ne *) 0x5000;
• Receive ring is initialized in the fn.Receive ring is initialized in the fn.
‘‘newmain’ asnewmain’ 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()enable_irq()function enables the irq’s of function enables the irq’s of
keyboard and the two n/w cards.keyboard and the two n/w cards.
• Two function are registered :Two function are registered :
net1()net1() as ISR of n/w card 1 as ISR of n/w card 1
net2()net2() as ISR of n/w card 2as ISR of n/w card 2
• Both functions call common function :Both functions call common function :
net(addr1,addr2)net(addr1,addr2)
net1 net1 calls with ioAd1 and ioAd2calls with ioAd1 and ioAd2
net2 net2 with ioAd2 and ioAd1 as parameters with ioAd2 and ioAd1 as parameters
InterruptsInterrupts
• Both the card receives to Both the card receives to n->rx_ringn->rx_ring one at a one at a time.time.
• After a single reception :After a single reception :
1 1 2
statusstatus
n->rx_ringn->rx_ring
nextnextsizesize
Size = header + pckt lengthSize = header + pckt length
rest of pcktrest of pckt
ReceptionReception
• Put the address of packet to be transmitted Put the address of packet to be transmitted
to Transmit address registerto Transmit address register
outl((unsigned int)(n->rx_ring+4), outl((unsigned int)(n->rx_ring+4),
,ioAd2+TXADDR0);,ioAd2+TXADDR0);
• Tell the network card to transmit it Tell the network card to transmit it outl(0xffffdfff & (myflag|outl(0xffffdfff & (myflag|
((unsigned int)hdr.h.count-4)) ((unsigned int)hdr.h.count-4))
,ioAd2+TXSTATUS0);,ioAd2+TXSTATUS0);
High lights of TransmissionHigh lights of Transmission
• Usual drivers use upto 4 xmit buffersUsual drivers use upto 4 xmit buffers
• When transmit success, interrupt raised When 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 transmitted
while(!(inl(ioAd2+TXSTATUS0)&0x00008000)) while(!(inl(ioAd2+TXSTATUS0)&0x00008000))
{{
times++;times++;
if (times == 100) break;if (times == 100) break; }}
The differenceThe difference
• Traffic of one side greater then always the card Traffic of one side greater then always the card of that side gets serviced(if it has low irq no.)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 After an interrupt is serviced, its priority is made lowest . Hence all equal 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 *//* and D5=S=1 */
outb(0xa0,0x20); outb(0xa0,0x20);
outb(0xa0,0xa0);outb(0xa0,0xa0);
The BugThe Bug
• Transmitted packets from machine in one n/wTransmitted packets from machine in one n/w
to a machine in other n/wto 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 Tried changing the ip address when the packet was within GROS. Succededwas within GROS. Succeded
CheckingChecking
• GROS crashes when no of packets reach 2400 GROS crashes when no of packets reach 2400 rangerange
• 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 Verified packet nos by using the broadcast option of PING and TCPDUMP.option of PING and TCPDUMP.
• Changed stack location without success.Changed stack location without success.
Bug yet to be solved 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 Bug
SummarySummary
Thank YouThank You