@@ -60,16 +60,7 @@ qp_mgr::qp_mgr(struct qp_mgr_desc *desc, const uint32_t tx_num_wr):
6060 ,m_n_ip_id_base(0 )
6161 ,m_n_ip_id_offset(0 )
6262{
63- #ifdef DEFINED_TSO
64- memset (&m_qp_cap, 0 , sizeof (m_qp_cap));
65- m_qp_cap.max_inline_data = safe_mce_sys ().tx_max_inline ;
66- m_qp_cap.max_send_sge = (m_p_ring->is_tso () ?
67- m_p_ib_ctx_handler->get_ibv_device_attr ()->max_sge : MCE_DEFAULT_TX_NUM_SGE);
68- m_qp_cap.max_recv_sge = (m_p_ring->is_socketxtreme ()) ? 1 : MCE_DEFAULT_RX_NUM_SGE;
69- #else
7063 m_max_inline_data = 0 ;
71- #endif /* DEFINED_TSO */
72-
7364 m_ibv_rx_sg_array = new ibv_sge[m_n_sysvar_rx_num_wr_to_post_recv];
7465 m_ibv_rx_wr_array = new ibv_recv_wr[m_n_sysvar_rx_num_wr_to_post_recv];
7566
@@ -188,78 +179,6 @@ int qp_mgr::configure(struct qp_mgr_desc *desc)
188179 vma_ibv_qp_init_attr qp_init_attr;
189180 memset (&qp_init_attr, 0 , sizeof (qp_init_attr));
190181
191- #ifdef DEFINED_TSO
192- // TODO: m_tx_num_wr and m_rx_num_wr should be part of m_qp_cap
193- // and assigned as a result of ibv_query_qp()
194- m_qp_cap.max_send_wr = m_tx_num_wr;
195- m_qp_cap.max_recv_wr = m_rx_num_wr;
196-
197- memcpy (&qp_init_attr.cap , &m_qp_cap, sizeof (qp_init_attr.cap ));
198- qp_init_attr.recv_cq = m_p_cq_mgr_rx->get_ibv_cq_hndl ();
199- qp_init_attr.send_cq = m_p_cq_mgr_tx->get_ibv_cq_hndl ();
200- qp_init_attr.sq_sig_all = 0 ;
201-
202- // In case of enabled TSO we need to take into account amount of SGE together with header inline
203- // Per PRM maximum of CTRL + ETH + ETH_HEADER_INLINE+DATA_PTR*NUM_SGE+MAX_INLINE+INLINE_SIZE
204- // MLX5 return 32678 WQEBBs at max so minimal number
205- int max_wqe_sz = 16 +14 +m_p_ring->m_tso .max_header_sz +16 *qp_init_attr.cap .max_send_sge +qp_init_attr.cap .max_inline_data +4 ;
206- int num_wr = 32678 *64 /max_wqe_sz;
207- qp_logdbg (" calculated max_wqe_sz=%d num_wr=%d" , max_wqe_sz, num_wr);
208- if (num_wr < (signed )m_tx_num_wr) {
209- qp_init_attr.cap .max_send_wr = num_wr; // force min for create_qp or you will have error of memory allocation
210- }
211-
212- qp_logdbg (" Requested QP parameters: "
213- " wre: tx = %d rx = %d "
214- " sge: tx = %d rx = %d "
215- " inline: %d" ,
216- qp_init_attr.cap .max_send_wr , qp_init_attr.cap .max_recv_wr ,
217- qp_init_attr.cap .max_send_sge , qp_init_attr.cap .max_recv_sge ,
218- qp_init_attr.cap .max_inline_data );
219-
220- // Create the QP
221- if (prepare_ibv_qp (qp_init_attr)) {
222- return -1 ;
223- }
224-
225- qp_logdbg (" Configured QP parameters: "
226- " wre: tx = %d rx = %d "
227- " sge: tx = %d rx = %d "
228- " inline: %d" ,
229- qp_init_attr.cap .max_send_wr , qp_init_attr.cap .max_recv_wr ,
230- qp_init_attr.cap .max_send_sge , qp_init_attr.cap .max_recv_sge ,
231- qp_init_attr.cap .max_inline_data );
232-
233- /* Check initial parameters with actual */
234- enum ibv_qp_attr_mask attr_mask = IBV_QP_CAP;
235- struct ibv_qp_attr tmp_ibv_qp_attr;
236- struct ibv_qp_init_attr tmp_ibv_qp_init_attr;
237- IF_VERBS_FAILURE (ibv_query_qp (m_qp, &tmp_ibv_qp_attr, attr_mask,
238- &tmp_ibv_qp_init_attr)) {
239- qp_logerr (" ibv_query_qp failed (errno=%d %m)" , errno);
240- return -1 ;
241- } ENDIF_VERBS_FAILURE;
242- m_qp_cap.max_send_wr = min (tmp_ibv_qp_attr.cap .max_send_wr , m_qp_cap.max_send_wr );
243- m_qp_cap.max_recv_wr = min (tmp_ibv_qp_attr.cap .max_recv_wr , m_qp_cap.max_recv_wr );
244- m_qp_cap.max_send_sge = min (tmp_ibv_qp_attr.cap .max_send_sge , m_qp_cap.max_send_sge );
245- m_qp_cap.max_recv_sge = min (tmp_ibv_qp_attr.cap .max_recv_sge , m_qp_cap.max_recv_sge );
246- m_qp_cap.max_inline_data = min (tmp_ibv_qp_attr.cap .max_inline_data , m_qp_cap.max_inline_data );
247-
248- if ( m_qp_cap.max_send_wr < m_tx_num_wr ) {
249- qp_logwarn (" Amount of requested TX_WRE %d lowered to %d" , m_tx_num_wr, m_qp_cap.max_send_wr );
250- m_tx_num_wr = m_qp_cap.max_send_wr ;
251- m_p_ring->set_tx_num_wr ( m_tx_num_wr );
252- }
253-
254- qp_logdbg (" Used QP (num=%d) "
255- " wre: tx = %d rx = %d "
256- " sge: tx = %d rx = %d "
257- " inline: %d" ,
258- m_qp->qp_num ,
259- m_qp_cap.max_send_wr , m_qp_cap.max_recv_wr ,
260- m_qp_cap.max_send_sge , m_qp_cap.max_recv_sge ,
261- m_qp_cap.max_inline_data );
262- #else
263182 // Check device capabilities for max SG elements
264183 uint32_t tx_max_inline = safe_mce_sys ().tx_max_inline ;
265184 uint32_t rx_num_sge = (m_p_ring->is_socketxtreme () ? 1 : MCE_DEFAULT_RX_NUM_SGE);
@@ -282,7 +201,6 @@ int qp_mgr::configure(struct qp_mgr_desc *desc)
282201 qp_logdbg (" Created QP (num=%d) with %d tx wre and inline=%d and %d rx "
283202 " wre and %d sge" , m_qp->qp_num , m_tx_num_wr, m_max_inline_data,
284203 m_rx_num_wr, rx_num_sge);
285- #endif /* DEFINED_TSO */
286204
287205#if defined(DEFINED_ROCE_LAG)
288206 if (desc->slave && desc->slave ->lag_tx_port_affinity > 0 ) {
@@ -680,13 +598,6 @@ int qp_mgr_eth::prepare_ibv_qp(vma_ibv_qp_init_attr& qp_init_attr)
680598 qp_init_attr.qp_type = IBV_QPT_RAW_PACKET;
681599 vma_ibv_qp_init_attr_comp_mask (m_p_ib_ctx_handler->get_ibv_pd (), qp_init_attr);
682600
683- #ifdef DEFINED_TSO
684- if (m_p_ring->is_tso ()) {
685- vma_ibv_qp_init_attr_tso (qp_init_attr, m_p_ring->get_max_header_sz ());
686- qp_logdbg (" create qp with max_tso_header = %d" , m_p_ring->get_max_header_sz ());
687- }
688- #endif /* DEFINED_TSO */
689-
690601 m_qp = vma_ibv_create_qp (m_p_ib_ctx_handler->get_ibv_pd (), &qp_init_attr);
691602
692603 BULLSEYE_EXCLUDE_BLOCK_START
@@ -701,8 +612,6 @@ int qp_mgr_eth::prepare_ibv_qp(vma_ibv_qp_init_attr& qp_init_attr)
701612 }
702613 BULLSEYE_EXCLUDE_BLOCK_END
703614
704- #ifdef DEFINED_TSO
705- #else
706615 enum ibv_qp_attr_mask attr_mask = IBV_QP_CAP;
707616 struct ibv_qp_attr tmp_ibv_qp_attr;
708617 struct ibv_qp_init_attr tmp_ibv_qp_init_attr;
@@ -711,16 +620,18 @@ int qp_mgr_eth::prepare_ibv_qp(vma_ibv_qp_init_attr& qp_init_attr)
711620 qp_logerr (" ibv_query_qp failed (errno=%d %m)" , errno);
712621 return -1 ;
713622 } ENDIF_VERBS_FAILURE;
623+
714624 uint32_t tx_max_inline = safe_mce_sys ().tx_max_inline ;
715625 m_max_inline_data = min (tmp_ibv_qp_attr.cap .max_inline_data , tx_max_inline);
626+
716627 qp_logdbg (" requested max inline = %d QP, actual max inline = %d, "
717628 " VMA max inline set to %d, max_send_wr=%d, max_recv_wr=%d, "
718629 " max_recv_sge=%d, max_send_sge=%d" ,
719630 tx_max_inline, tmp_ibv_qp_init_attr.cap .max_inline_data ,
720631 m_max_inline_data, tmp_ibv_qp_attr.cap .max_send_wr ,
721632 tmp_ibv_qp_attr.cap .max_recv_wr , tmp_ibv_qp_attr.cap .max_recv_sge ,
722633 tmp_ibv_qp_attr.cap .max_send_sge );
723- # endif /* DEFINED_TSO */
634+
724635 return 0 ;
725636}
726637
@@ -750,13 +661,6 @@ int qp_mgr_ib::prepare_ibv_qp(vma_ibv_qp_init_attr& qp_init_attr)
750661 qp_init_attr.qp_type = IBV_QPT_UD;
751662 vma_ibv_qp_init_attr_comp_mask (m_p_ib_ctx_handler->get_ibv_pd (), qp_init_attr);
752663
753- #ifdef DEFINED_TSO
754- if (m_p_ring->is_tso ()) {
755- vma_ibv_qp_init_attr_tso (qp_init_attr, m_p_ring->get_max_header_sz ());
756- qp_logdbg (" create qp with max_tso_header = %d" , m_p_ring->get_max_header_sz ());
757- }
758- #endif /* DEFINED_TSO */
759-
760664 if (m_underly_qpn) {
761665 ibv_source_qpn_set (qp_init_attr, m_underly_qpn);
762666 qp_logdbg (" create qp using underly qpn = 0x%X" , m_underly_qpn);
@@ -781,8 +685,6 @@ int qp_mgr_ib::prepare_ibv_qp(vma_ibv_qp_init_attr& qp_init_attr)
781685 }
782686 BULLSEYE_EXCLUDE_BLOCK_END
783687
784- #ifdef DEFINED_TSO
785- #else
786688 enum ibv_qp_attr_mask attr_mask = IBV_QP_CAP;
787689 struct ibv_qp_attr tmp_ibv_qp_attr;
788690 struct ibv_qp_init_attr tmp_ibv_qp_init_attr;
@@ -791,16 +693,17 @@ int qp_mgr_ib::prepare_ibv_qp(vma_ibv_qp_init_attr& qp_init_attr)
791693 qp_logerr (" ibv_query_qp failed (errno=%d %m)" , errno);
792694 return -1 ;
793695 } ENDIF_VERBS_FAILURE;
696+
794697 uint32_t tx_max_inline = safe_mce_sys ().tx_max_inline ;
795698 m_max_inline_data = min (tmp_ibv_qp_attr.cap .max_inline_data , tx_max_inline);
699+
796700 qp_logdbg (" requested max inline = %d QP, actual max inline = %d, "
797701 " VMA max inline set to %d, max_send_wr=%d, max_recv_wr=%d, "
798702 " max_recv_sge=%d, max_send_sge=%d" ,
799703 tx_max_inline, tmp_ibv_qp_init_attr.cap .max_inline_data ,
800704 m_max_inline_data, tmp_ibv_qp_attr.cap .max_send_wr ,
801705 tmp_ibv_qp_attr.cap .max_recv_wr , tmp_ibv_qp_attr.cap .max_recv_sge ,
802706 tmp_ibv_qp_attr.cap .max_send_sge );
803- #endif /* DEFINED_TSO */
804707
805708 return 0 ;
806709}
0 commit comments