[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ns] How can I Modify Hash Classifier in DRR?



Hi all.

> It's not strange as the expanded address format is obsolete.
default addresize is 32bit now?(I mean 22 bits node id and 8 bit port id?)
if so, hash function in drr.cc 0xfff0 masking correct?
----------------------------------
int DRR::hash(Packet* pkt)
{
 hdr_ip *iph=(hdr_ip*)pkt->access(off_ip_);
 int i;
 if (mask_)
  i = (int)iph->saddr() & (0xfff0);<==????? 0xff0 ????
 else
  i = (int)iph->saddr();
 return ((i + (i >> 8) + ~(i>>4)) % ((2<<23)-1))+1;
}
----------------------------------
> Not enough info.  What exactly is the error?
> In general, you don't have to set the buckets.  NS creates more
> buckets for you if need be.
I have these error message during simulation
----------------------------------
-snip-
Collisions between 0 and 110 src addresses
Collisions between 0 and 106 src addresses
Collisions between 0 and 110 src addresses
-snip-
in drr.cc
/*detect collisions here */
 int compare=(!mask_ ? ((int)iph->saddr()) : ((int)iph->saddr()&0xfff0));
 if (q->src ==-1)
  q->src=compare;
 else
  if (q->src != compare)
   fprintf(stderr,"Collisions between %d and %d src
addresses\n",q->src,(int)iph->saddr());
----------------------------------

I want each session have it's own queue. But it seems like they didn't. And
I think not enough buckets in drr makes these problem.

here is my test.tcl code(I modify test-drr.tcl a little for TCP)

#default Mask parameter
set MASK 0
if { [lindex $argv 0] == "setmask" } {
    set MASK 1
    puts stderr "Ignoring port nos of sources"
}

set ns [new Simulator]
#Node expandaddr
#1024 sender
for {set i 0} {$i < 1024} {incr i} {
 set s($i) [$ns node]
}
#receiver
set r0 [$ns node]
#router
set g0 [$ns node]

$ns duplex-link $g0 $r0 10.0Mb 0.01ms DRR
for {set i 0} {$i < 1024} {incr i} {
 $ns duplex-link $s($i) $g0 1.0Mb 0.01ms DropTail
}

# trace the bottleneck queue
$ns trace-queue $g0 $r0 $f

Simulator instproc get-link { node1 node2 } {
    $self instvar link_
    set id1 [$node1 id]
    set id2 [$node2 id]
    return $link_($id1:$id2)
}

#Alternate way for setting parameters for the DRR queue
set l [$ns get-link $g0 $r0]
set q [$l queue]

$q mask $MASK
$q blimit 25000
$q quantum 500
#conflict!
$q buckets 2^15

# create 1024 TCP sources :
for {set i 0} {$i < 1024} {incr i} {
 set tcp($i) [new Agent/TCP/Reno]
 $ns attach-agent $s($i) $tcp($i)
 set ftp($i) [new Application/FTP]
 $ftp($i) attach-agent $tcp($i)
}
# create 1024 receiver
for {set i 0} {$i < 1024} {incr i} {
 set sink($i) [new Agent/TCPSink]
 $ns attach-agent $r0 $sink($i)
}
# receiver 0 :
#set lm0 [new Agent/Null]
#$ns attach-agent $n(1) $lm0

for {set i 0} {$i < 1024} {incr i} {
 $ns connect $tcp($i) $sink($i)
}

for {set i 0} {$i < 1024} {incr i} {
 $ns at 0.0 "$ftp($i) start"
}

for {set i 0} {$i < 1024} {incr i} {
 $ns at 0.1 "$ftp($i) stop"
}

$ns at 0.5 "close $f;finish"




Anything Did I Missed? or should i have to modify drr's hash function?

Any Information Fine and really aprreicate.

__

�ֿ��� (ChoiYoungSoo)
e-m@ail   : mailto:[email protected]
icq       : 43998959
myh0me    : http://palgong.knu.ac.kr/~guru0109
TeNet Lab : http://tenet.knu.ac.kr/