@@ -381,7 +381,7 @@ int smc_llc_send_confirm_link(struct smc_link *link,
381
381
hton24 (confllc -> sender_qp_num , link -> roce_qp -> qp_num );
382
382
confllc -> link_num = link -> link_id ;
383
383
memcpy (confllc -> link_uid , lgr -> id , SMC_LGR_ID_SIZE );
384
- confllc -> max_links = SMC_LLC_ADD_LNK_MAX_LINKS ; /* enforce peer resp. */
384
+ confllc -> max_links = SMC_LLC_ADD_LNK_MAX_LINKS ;
385
385
/* send llc message */
386
386
rc = smc_wr_tx_send (link , pend );
387
387
return rc ;
@@ -724,6 +724,61 @@ static int smc_llc_cli_add_link_reject(struct smc_llc_qentry *qentry)
724
724
return smc_llc_send_message (qentry -> link , & qentry -> msg );
725
725
}
726
726
727
+ static int smc_llc_cli_conf_link (struct smc_link * link ,
728
+ struct smc_init_info * ini ,
729
+ struct smc_link * link_new ,
730
+ enum smc_lgr_type lgr_new_t )
731
+ {
732
+ struct smc_link_group * lgr = link -> lgr ;
733
+ struct smc_llc_msg_del_link * del_llc ;
734
+ struct smc_llc_qentry * qentry = NULL ;
735
+ int rc = 0 ;
736
+
737
+ /* receive CONFIRM LINK request over RoCE fabric */
738
+ qentry = smc_llc_wait (lgr , NULL , SMC_LLC_WAIT_FIRST_TIME , 0 );
739
+ if (!qentry ) {
740
+ rc = smc_llc_send_delete_link (link , link_new -> link_id ,
741
+ SMC_LLC_REQ , false,
742
+ SMC_LLC_DEL_LOST_PATH );
743
+ return - ENOLINK ;
744
+ }
745
+ if (qentry -> msg .raw .hdr .common .type != SMC_LLC_CONFIRM_LINK ) {
746
+ /* received DELETE_LINK instead */
747
+ del_llc = & qentry -> msg .delete_link ;
748
+ qentry -> msg .raw .hdr .flags |= SMC_LLC_FLAG_RESP ;
749
+ smc_llc_send_message (link , & qentry -> msg );
750
+ smc_llc_flow_qentry_del (& lgr -> llc_flow_lcl );
751
+ return - ENOLINK ;
752
+ }
753
+ smc_llc_flow_qentry_del (& lgr -> llc_flow_lcl );
754
+
755
+ rc = smc_ib_modify_qp_rts (link_new );
756
+ if (rc ) {
757
+ smc_llc_send_delete_link (link , link_new -> link_id , SMC_LLC_REQ ,
758
+ false, SMC_LLC_DEL_LOST_PATH );
759
+ return - ENOLINK ;
760
+ }
761
+ smc_wr_remember_qp_attr (link_new );
762
+
763
+ rc = smcr_buf_reg_lgr (link_new );
764
+ if (rc ) {
765
+ smc_llc_send_delete_link (link , link_new -> link_id , SMC_LLC_REQ ,
766
+ false, SMC_LLC_DEL_LOST_PATH );
767
+ return - ENOLINK ;
768
+ }
769
+
770
+ /* send CONFIRM LINK response over RoCE fabric */
771
+ rc = smc_llc_send_confirm_link (link_new , SMC_LLC_RESP );
772
+ if (rc ) {
773
+ smc_llc_send_delete_link (link , link_new -> link_id , SMC_LLC_REQ ,
774
+ false, SMC_LLC_DEL_LOST_PATH );
775
+ return - ENOLINK ;
776
+ }
777
+ smc_llc_link_active (link_new );
778
+ lgr -> type = lgr_new_t ;
779
+ return 0 ;
780
+ }
781
+
727
782
static void smc_llc_save_add_link_info (struct smc_link * link ,
728
783
struct smc_llc_msg_add_link * add_llc )
729
784
{
@@ -785,7 +840,7 @@ int smc_llc_cli_add_link(struct smc_link *link, struct smc_llc_qentry *qentry)
785
840
rc = 0 ;
786
841
goto out_clear_lnk ;
787
842
}
788
- /* tbd: rc = smc_llc_cli_conf_link(link, &ini, lnk_new, lgr_new_t); */
843
+ rc = smc_llc_cli_conf_link (link , & ini , lnk_new , lgr_new_t );
789
844
if (!rc )
790
845
goto out ;
791
846
out_clear_lnk :
@@ -797,6 +852,17 @@ int smc_llc_cli_add_link(struct smc_link *link, struct smc_llc_qentry *qentry)
797
852
return rc ;
798
853
}
799
854
855
+ static void smc_llc_process_cli_add_link (struct smc_link_group * lgr )
856
+ {
857
+ struct smc_llc_qentry * qentry ;
858
+
859
+ qentry = smc_llc_flow_qentry_clr (& lgr -> llc_flow_lcl );
860
+
861
+ mutex_lock (& lgr -> llc_conf_mutex );
862
+ smc_llc_cli_add_link (qentry -> link , qentry );
863
+ mutex_unlock (& lgr -> llc_conf_mutex );
864
+ }
865
+
800
866
/* worker to process an add link message */
801
867
static void smc_llc_add_link_work (struct work_struct * work )
802
868
{
@@ -809,7 +875,8 @@ static void smc_llc_add_link_work(struct work_struct *work)
809
875
goto out ;
810
876
}
811
877
812
- /* tbd: call smc_llc_process_cli_add_link(lgr); */
878
+ if (lgr -> role == SMC_CLNT )
879
+ smc_llc_process_cli_add_link (lgr );
813
880
/* tbd: call smc_llc_process_srv_add_link(lgr); */
814
881
out :
815
882
smc_llc_flow_stop (lgr , & lgr -> llc_flow_lcl );
0 commit comments