Skip to content

Commit 0b41ed2

Browse files
committed
reduce memory usage: remove qp after finish
1 parent 740333c commit 0b41ed2

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

simulation/src/point-to-point/model/rdma-hw.cc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,13 @@ void RdmaHw::AddQueuePair(uint64_t size, uint16_t pg, Ipv4Address sip, Ipv4Addre
256256
m_nic[nic_idx].dev->NewQp(qp);
257257
}
258258

259+
void RdmaHw::DeleteQueuePair(Ptr<RdmaQueuePair> qp){
260+
// [ignore] delete qp from NIC
261+
// remove qp from the m_qpMap
262+
uint64_t key = GetQpKey(qp->dip.Get(), qp->sport, qp->m_pg);
263+
m_qpMap.erase(key);
264+
}
265+
259266
Ptr<RdmaRxQueuePair> RdmaHw::GetRxQp(uint32_t sip, uint32_t dip, uint16_t sport, uint16_t dport, uint16_t pg, bool create){
260267
uint64_t key = ((uint64_t)dip << 32) | ((uint64_t)pg << 16) | (uint64_t)dport;
261268
auto it = m_rxQpMap.find(key);
@@ -493,6 +500,9 @@ void RdmaHw::QpComplete(Ptr<RdmaQueuePair> qp){
493500
Simulator::Cancel(qp->mlx.m_rpTimer);
494501
}
495502
m_qpCompleteCallback(qp);
503+
504+
// delete the qp
505+
DeleteQueuePair(qp);
496506
}
497507

498508
void RdmaHw::SetLinkDown(Ptr<QbbNetDevice> dev){

simulation/src/point-to-point/model/rdma-hw.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ class RdmaHw : public Object {
5252
Ptr<RdmaQueuePair> GetQp(uint32_t dip, uint16_t sport, uint16_t pg); // get the qp
5353
uint32_t GetNicIdxOfQp(Ptr<RdmaQueuePair> qp); // get the NIC index of the qp
5454
void AddQueuePair(uint64_t size, uint16_t pg, Ipv4Address _sip, Ipv4Address _dip, uint16_t _sport, uint16_t _dport, uint32_t win, uint64_t baseRtt); // add a new qp (new send)
55+
void DeleteQueuePair(Ptr<RdmaQueuePair> qp);
5556

5657
Ptr<RdmaRxQueuePair> GetRxQp(uint32_t sip, uint32_t dip, uint16_t sport, uint16_t dport, uint16_t pg, bool create); // get a rxQp
5758
uint32_t GetNicIdxOfRxQp(Ptr<RdmaRxQueuePair> q); // get the NIC index of the rxQp

0 commit comments

Comments
 (0)