Changeset 3762 in Sophya for trunk/AddOn/TAcq
- Timestamp:
- May 2, 2010, 12:32:43 AM (15 years ago)
- Location:
- trunk/AddOn/TAcq
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/AddOn/TAcq/racqueth.cc
r3759 r3762 41 41 nbDma_= vec_pciw.size(); 42 42 43 // true -> direct transfer of data to ethernet 44 fgdirectsend_ = (par_.pci2eth_fgdirect && (swapall_==BR_Copy) ) ? true : false; 43 45 char msg[BRTCPMSGLEN]; 44 46 cout << "PCIEToEthernet/Info: Establishing TCP/IP connections ... " << endl; … … 48 50 ClientSocket sok(destname_[j], tcpportid_); 49 51 for(int ii=0; ii<BRTCPMSGLEN; ii++) msg[ii]='\0'; 50 sprintf(msg,"BAORadio-PCIEToEthernet %d %d",0,i); 52 uint_4 dmasz = (fgdirectsend_) ? vec_pciw_[0]->TransferSize() : 0; 53 sprintf(msg,"BAORadio-PCIEToEthernet %d %d %d %d %d", par_.MMgrNbPaquet(), par_.MMgrPaquetSize(), dmasz, 0,i); 54 // 123456789012345678901234567890 51 55 sok.Send(msg,BRTCPMSGLEN); 52 56 sok.Receive(msg,BRTCPMSGLEN); … … 56 60 vskt.push_back(sok); 57 61 } 58 vvec_skt_.push_back(vskt); 62 vvec_skt_.push_back(vskt); 63 vec_cntpaq_.push_back(0); 59 64 } 60 65 totrdsnd_ = 0; … … 112 117 } 113 118 114 bool fgdirectsend = (par_.pci2eth_fgdirect && (swapall_==BR_Copy) ) ? true : false; // true -> direct transfer of data to ethernet 115 if (fgdirectsend) 119 if (fgdirectsend_) 116 120 cout << " PCIEToEthernet::run() Direct transfer mode DMA to Ethernet ... " << endl; 117 121 bool fgredpaq=par_.fgreducpsize; … … 178 182 if ((prtlev_>0)&&(npaqfaitg%prtmod==0)) 179 183 cout << " PCIEToEthernet::run()/Info NPaqFait= " << npaqfaitg << endl; 180 if (fgdirectsend ) { // Pas de copie / reduction de taille de paquet, on rebalance tel quel ...184 if (fgdirectsend_) { // Pas de copie / reduction de taille de paquet, on rebalance tel quel ... 181 185 for (int fib=0; fib<(int) nbDma_ ;fib++) { 182 186 //DBG cout << " DEBUG*B fib=" << fib << " Datas[fib]=" << hex << Datas[fib] << dec << endl; … … 285 289 cout << " kb" << endl; 286 290 287 if (!fgdirectsend ) pcheck[dma].Print(cout);291 if (!fgdirectsend_) pcheck[dma].Print(cout); 288 292 } 289 293 cout << " --------------------------------------------------------------------" << endl; … … 315 319 vector<ClientSocket>& vskt = vvec_skt_[fib]; 316 320 size_t rc=0; 321 if (vec_cntpaq_[fib]%par_.MMgrNbPaquet() == 0) { 322 char msg[BRTCPMSGLEN2]; 323 sprintf(msg,"PCIEToEthernet-SendCnt %d",vec_cntpaq_[fib]); 324 for(size_t j=0; j<vskt.size(); j++) { 325 vskt[j].Send(msg, BRTCPMSGLEN2); 326 } 327 if (vec_cntpaq_[fib]>0) { 328 for(size_t j=0; j<vskt.size(); j++) { 329 vskt[j].Receive(msg, BRTCPMSGLEN2); 330 msg[BRTCPMSGLEN2-1]='\0'; 331 if (strncmp(msg,"EthernetReader-RecvCnt",22) != 0) 332 cout << " PCIEToEthernet::SendToTargets/ BAD HandShake message : " << msg << endl; 333 } 334 } 335 } 336 if (eths_bsz_<16) { 337 for(size_t j=0; j<vskt.size(); j++) { 338 rc += vskt[j].Send((const char *)data, len); 339 totrdsnd_ += eths_bsz_; 340 } 341 vec_cntpaq_[fib]++; 342 return rc; 343 } 317 344 size_t nblk = len/eths_bsz_; 318 345 size_t fblk = len%eths_bsz_; … … 333 360 } 334 361 } 362 vec_cntpaq_[fib]++; 335 363 return rc; 336 364 } … … 372 400 if (strncmp(msg,"BAORadio-PCIEToEthernet",23)!=0) 373 401 throw SocketException("EthernetReader:ERROR/ Bad message from PCIEToEthernet client !"); 402 int ia,ib,ic,id,ie; 403 sscanf(msg+25,"%d %d %d %d %d",&ia,&ib,&ic,&id,&ie); 404 if (((uint_4)ia!=par_.MMgrNbPaquet()) || ((uint_4)ib!=par_.MMgrPaquetSize())) { 405 strcpy(msg,"BAORadio-EthernetReader-BAD MMgrNbPaquet/MMgrPaquetSize()"); 406 sok.Send(msg,BRTCPMSGLEN); 407 throw SocketException("EthernetReader:ERROR/ Bad MMgrNbPaquet/MMgrPaquetSize() from PCIEToEthernet client !"); 408 } 374 409 for(int ii=0; ii<BRTCPMSGLEN; ii++) msg[ii]='\0'; 375 410 strcpy(msg,"BAORadio-EthernetReader-OK"); … … 377 412 vsok_.push_back(sok); 378 413 cout << " EthernetReader/Info connection/link" << fib << " established." << endl; 414 vec_cntpaq_.push_back(0); 379 415 } 380 416 … … 510 546 size_t EthernetReader::ReceiveFromSocket(int fib, char* data, size_t len) 511 547 { 512 size_t nblk = len/ethr_bsz_;513 size_t fblk = len%ethr_bsz_;514 size_t off = 0;515 548 size_t rc =0; 516 if (nblk>0) { 517 for(size_t i=0; i<nblk; i++) { 518 rc += vsok_[fib].Receive(data+off, ethr_bsz_); 519 off += ethr_bsz_; 520 } 521 } 522 if (fblk>0) { 523 rc += vsok_[fib].Receive(data+off, fblk); 524 } 549 if (vec_cntpaq_[fib]%par_.MMgrNbPaquet() == 0) { 550 char msg[BRTCPMSGLEN2]; 551 msg[0]='\0'; 552 vsok_[fib].Receive(msg, BRTCPMSGLEN2); 553 if (strncmp(msg,"PCIEToEthernet-SendCnt",22) != 0) 554 cout << " EthernetReader::ReceiveFromSocket/ BAD HandShake message : " << msg << endl; 555 } 556 557 if (ethr_bsz_<16) { 558 rc += vsok_[fib].Receive(data, len); 559 } 560 else { 561 size_t nblk = len/ethr_bsz_; 562 size_t fblk = len%ethr_bsz_; 563 size_t off = 0; 564 if (nblk>0) { 565 for(size_t i=0; i<nblk; i++) { 566 rc += vsok_[fib].Receive(data+off, ethr_bsz_); 567 off += ethr_bsz_; 568 } 569 } 570 if (fblk>0) { 571 rc += vsok_[fib].Receive(data+off, fblk); 572 } 573 } 574 vec_cntpaq_[fib]++; 575 576 if (vec_cntpaq_[fib]%par_.MMgrNbPaquet() == 0) { 577 char msg[BRTCPMSGLEN2]; 578 sprintf(msg,"EthernetReader-RecvCnt %d",vec_cntpaq_[fib]); 579 vsok_[fib].Send(msg, BRTCPMSGLEN2); 580 } 525 581 return rc; 526 582 } -
trunk/AddOn/TAcq/racqueth.h
r3759 r3762 40 40 #define BRTCPMSGLEN 128 41 41 #endif 42 #ifndef BRTCPMSGLEN2 43 #define BRTCPMSGLEN2 64 44 #endif 42 45 43 46 … … 71 74 int tcpportid_; 72 75 vector< vector<ClientSocket> > vvec_skt_; 76 vector< uint_4 > vec_cntpaq_; 73 77 uint_4 packSize_; 74 78 uint_4 packSizeInMgr_; 75 79 uint_4 nbDma_; 76 80 uint_8 totrdsnd_; 81 bool fgdirectsend_; // true -> direct transfer of DMA data to ethernet 77 82 size_t eths_bsz_; 78 83 int prtlev_; … … 116 121 int tcpportid_; 117 122 vector< Socket > vsok_; // Les sockets de lecture pour chaque fibre/lien 123 vector< uint_4 > vec_cntpaq_; 118 124 bool stop_; 119 125 bool rdsamefc_; // if true, read paquets with same value of FrameCounter on different fibers/link
Note:
See TracChangeset
for help on using the changeset viewer.