How can you solve "Packet Overrun" problem in the "part_blk" Example.

김은석 air4334magic at ...143...
Mon Nov 12 01:00:19 CET 2012


 
Dear. genode...


 

I have an issue in the "part_blk" Example code. 
I have tested the program on the pandaboard with a little modifcation.

I have "Packet Overrun" problem when i apply request size of 128kbytes.
Could you please advice me how can i solve this issue.
Following Example code is the modified version of "part_blk" Example.
 

Modified version genode Example code -------------------------------------------------------------------------------------
 
class Sector
{
~~~~~~~~~ skip ~~~~~~~~
}
 

#define DB_SIZE  1*1024*1024 // 1M
#define RETRY_NUM 5
#define _HIGH(_A_) (unsigned int)(_A_)
#define _LOW(_B_, _C_ )   (unsigned int)(((_B_) - (unsigned int)(_B_))*(_C_))
unsigned int request_size = 0;
static Timer::Connection timer;
unsigned long timer_start, timer_end;
unsigned int request_table[10] = { 512, 1024, 2048, 4096, 8192, 16384 , 32768, 65536, 131072, 0 };
Sector s;
int main()
{

Genode::printf("**************************************************\n");
Genode::printf("**      Test Program for part blk speed check.  **\n");
Genode::printf("**************************************************\n");

  unsigned pattern;
 try {
  Genode::config()->xml_node().attribute("pattern").value(&pattern); }
 catch (...) { PERR("Test Failed"); return 1; }
 
 size_t blk_count;
 Block::Session::Operations ops;
 _blk.info(&blk_count, &_blk_size, &ops);
 if (verbose)
  printf("Found device %zu blocks of %zu bytes\n", blk_count, _blk_size);

 size_t bytes_sended = 0;
 size_t toWrite_blk_count = DB_SIZE / _blk_size;
 unsigned int request_blk_count = 0;
 double speed[RETRY_NUM] = {0.0,};
 int k =0;
 // Write speed check code with re-try number and variablable request_size. 
 while ( (request_size = request_table[k]) != 0 )
 {
  request_blk_count = request_size / _blk_size;
  bytes_sended = toWrite_blk_count * _blk_size;
  int i =0;
  /* write first and last block of device useing 'pattern' */
  for( i=0; i < RETRY_NUM ; i++ )
  {
   timer_start = timer.elapsed_ms();
   for( int j =0; j < toWrite_blk_count/request_blk_count ; j++)
   {
     s = Sector( j*request_blk_count + i*toWrite_blk_count , request_blk_count, true);
    memset(s.addr<void *>(), pattern + i, request_blk_count * _blk_size);
    s.submit_request();
   }
   timer_end = timer.elapsed_ms();
   speed[i] = ((double)bytes_sended * 1000.0) / static_cast<double>(timer_end - timer_start);
  }

  double total_speed = 0;
  for( i =0; i < RETRY_NUM; i++)
   total_speed += speed[i];
  total_speed = total_speed / RETRY_NUM;
  double spd_kbps = total_speed / 1024;
  PLOG("WRITE request_size=%u : speed_KBPS=%u.%03u, bytes_send: %u TRY_num: %d", request_size, _HIGH(spd_kbps), _LOW(spd_kbps, 1000) , bytes_sended, RETRY_NUM );
  k++;
 }

 unsigned *val = 0;
 unsigned *val_last = 0;
 size_t bytes_rcved = 0;
 k = 0;
 request_size = 0;
 char ** rcv_buffer = 0;
 rcv_buffer = new ( env()->heap() ) char * [RETRY_NUM];
 for(int i=0; i < RETRY_NUM; i++)
  rcv_buffer[i] = new ( env()->heap() ) char[DB_SIZE];

 while ( (request_size = request_table[k]) != 0 )
 {
  request_blk_count = request_size / _blk_size;
  bytes_rcved = toWrite_blk_count * _blk_size;
  int i =0;

  /* write first and last block of device useing 'pattern' */
  for( i=0; i < RETRY_NUM ; i++ )
  {
   timer_start = timer.elapsed_ms();
 
   for(int j =0; j < toWrite_blk_count/request_blk_count ; j++)
   {
    /* read first and last block from device and compare to 'pattern' */
    s = Sector( j*request_blk_count + i*toWrite_blk_count , request_blk_count, false );
    s.submit_request();
    val      = s.addr<unsigned *>();
    memcpy( &(rcv_buffer[i][j*request_blk_count*_blk_size]) , val , request_blk_count * _blk_size );
   }
 
   timer_end = timer.elapsed_ms();
   speed[i] = ((double)bytes_rcved * 1000.0) / static_cast<double>(timer_end - timer_start);
  }

  double total_speed = 0;
  for( i =0; i < RETRY_NUM; i++)
   total_speed += speed[i];
  total_speed = total_speed / RETRY_NUM;
  double spd_kbps = total_speed / 1024;

  PLOG("READ request_size=%u : speed_KBPS=%u.%03u, bytes_rcved: %u TRY_num: %d", request_size, _HIGH(spd_kbps), _LOW(spd_kbps, 1000) , bytes_rcved, RETRY_NUM );
  k++;
 }
 for( int i=0; i< RETRY_NUM ; i++ )
  destroy( env()->heap() , rcv_buffer[i] );
 destroy( env()->heap() , rcv_buffer );

 }
 
 return 0;
}

 
Have a good day.
Thank you for your attention.
 

Eun Seok, Kim.
 
 
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.genode.org/pipermail/users/attachments/20121112/504bd968/attachment.html>


More information about the users mailing list