add a new constructor for ibvQpVonn and fixed a bug related to qpn generation
This commit is contained in:
parent
6b3cc41cfc
commit
c9b58f0342
|
@ -37,6 +37,7 @@ class ibvQpConn {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ibvQpConn(int32_t vfid, string ip_addr, uint32_t n_pages);
|
ibvQpConn(int32_t vfid, string ip_addr, uint32_t n_pages);
|
||||||
|
ibvQpConn(cProcess* cproc, string ip_addr, uint32_t n_pages);
|
||||||
~ibvQpConn();
|
~ibvQpConn();
|
||||||
|
|
||||||
// Connection
|
// Connection
|
||||||
|
|
|
@ -6,6 +6,8 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
|
||||||
namespace fpga {
|
namespace fpga {
|
||||||
|
|
||||||
|
@ -47,6 +49,15 @@ public:
|
||||||
|
|
||||||
ibvQp() : id(curr_id++) {}
|
ibvQp() : id(curr_id++) {}
|
||||||
inline uint32_t getId() { return id; }
|
inline uint32_t getId() { return id; }
|
||||||
|
|
||||||
|
void print() {
|
||||||
|
std::cout << "Queue Pair: "
|
||||||
|
<< "id: " << id << std::endl;
|
||||||
|
std::cout << "Local Queue: ";
|
||||||
|
local.print("local"); // Call the print function of ibvQ to print local queue variables
|
||||||
|
std::cout << "Remote Queue: ";
|
||||||
|
remote.print("remote"); // Call the print function of ibvQ to print remote queue variables
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -40,6 +40,19 @@ ibvQpConn::ibvQpConn(int32_t vfid, string ip_addr, uint32_t n_pages) {
|
||||||
initLocalQueue(ip_addr);
|
initLocalQueue(ip_addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ctor with user provided cProc
|
||||||
|
* @param: fdev - attached vFPGA
|
||||||
|
* @param: n_pages - number of buffer pages
|
||||||
|
*/
|
||||||
|
ibvQpConn::ibvQpConn(cProcess* cproc, string ip_addr, uint32_t n_pages): fdev(cproc), n_pages(n_pages) {
|
||||||
|
// Conn
|
||||||
|
is_connected = false;
|
||||||
|
|
||||||
|
// Initialize local queues
|
||||||
|
initLocalQueue(ip_addr);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dtor
|
* Dtor
|
||||||
*/
|
*/
|
||||||
|
@ -94,7 +107,7 @@ void ibvQpConn::initLocalQueue(string ip_addr) {
|
||||||
qpair->local.uintToGid(24, ibv_ip_addr);
|
qpair->local.uintToGid(24, ibv_ip_addr);
|
||||||
|
|
||||||
// qpn and psn
|
// qpn and psn
|
||||||
qpair->local.qpn = ((fdev->getVfid() & nRegMask) << pidBits) || (fdev->getCpid() & pidMask);
|
qpair->local.qpn = ((fdev->getVfid() & nRegMask) << pidBits) | (fdev->getCpid() & pidMask);
|
||||||
if(qpair->local.qpn == -1)
|
if(qpair->local.qpn == -1)
|
||||||
throw std::runtime_error("Coyote PID incorrect, vfid: " + fdev->getVfid());
|
throw std::runtime_error("Coyote PID incorrect, vfid: " + fdev->getVfid());
|
||||||
qpair->local.psn = distr(rand_gen) & 0xFFFFFF;
|
qpair->local.psn = distr(rand_gen) & 0xFFFFFF;
|
||||||
|
|
Loading…
Reference in New Issue