@@ -804,82 +804,6 @@ void rds_dma_hdrs_free(struct dma_pool *pool, struct rds_header **hdrs,
804
804
kvfree (dma_addrs );
805
805
}
806
806
807
- /* Worker function for freeing the DMA pool headers for sending and
808
- * receiving.
809
- */
810
- static void rds_dma_hdrs_cleanup_worker (struct work_struct * work )
811
- {
812
- struct rds_dma_hdrs_free_wk * wk ;
813
- struct dma_pool * pool ;
814
-
815
- wk = container_of (work , struct rds_dma_hdrs_free_wk , rdhf_work );
816
-
817
- pool = wk -> rdhf_pool ;
818
- if (wk -> rdhf_snd_hdrs )
819
- rds_dma_hdrs_free (pool , wk -> rdhf_snd_hdrs ,
820
- wk -> rdhf_snd_dma_addrs ,
821
- wk -> rdhf_snd_num_hdrs );
822
- if (wk -> rdhf_rcv_hdrs )
823
- rds_dma_hdrs_free (pool , wk -> rdhf_rcv_hdrs ,
824
- wk -> rdhf_rcv_dma_addrs ,
825
- wk -> rdhf_rcv_num_hdrs );
826
- if (wk -> rdhf_ack_rds_hdr )
827
- dma_pool_free (pool , wk -> rdhf_ack_rds_hdr ,
828
- wk -> rdhf_ack_dma_addr );
829
-
830
- kfree (wk );
831
- }
832
-
833
- /* Free all the DMA pool headers associated with an RDS RDMA connection.
834
- *
835
- * @ic: the RDS RDMA connection
836
- */
837
- static void rds_dma_hdrs_free_all (struct rds_ib_connection * ic )
838
- {
839
- struct rds_dma_hdrs_free_wk * wk ;
840
- struct dma_pool * pool ;
841
-
842
- pool = ic -> rds_ibdev -> rid_hdrs_pool ;
843
-
844
- wk = kmalloc (sizeof (* wk ), GFP_ATOMIC );
845
- if (wk ) {
846
- wk -> rdhf_pool = pool ;
847
-
848
- wk -> rdhf_snd_hdrs = ic -> i_send_hdrs ;
849
- wk -> rdhf_snd_dma_addrs = ic -> i_send_hdrs_dma ;
850
- wk -> rdhf_snd_num_hdrs = ic -> i_send_ring .w_nr ;
851
-
852
- wk -> rdhf_rcv_hdrs = ic -> i_recv_hdrs ;
853
- wk -> rdhf_rcv_dma_addrs = ic -> i_recv_hdrs_dma ;
854
- wk -> rdhf_rcv_num_hdrs = ic -> i_recv_ring .w_nr ;
855
-
856
- wk -> rdhf_ack_rds_hdr = ic -> i_ack ;
857
- wk -> rdhf_ack_dma_addr = ic -> i_ack_dma ;
858
-
859
- INIT_WORK (& wk -> rdhf_work , rds_dma_hdrs_cleanup_worker );
860
- queue_work (ic -> rds_ibdev -> rid_hdrs_pool_wq , & wk -> rdhf_work );
861
- } else {
862
- if (ic -> i_send_hdrs )
863
- rds_dma_hdrs_free (pool , ic -> i_send_hdrs ,
864
- ic -> i_send_hdrs_dma ,
865
- ic -> i_send_ring .w_nr );
866
- if (ic -> i_recv_hdrs )
867
- rds_dma_hdrs_free (pool , ic -> i_recv_hdrs ,
868
- ic -> i_recv_hdrs_dma ,
869
- ic -> i_recv_ring .w_nr );
870
- if (ic -> i_ack )
871
- dma_pool_free (pool , ic -> i_ack , ic -> i_ack_dma );
872
- }
873
-
874
- ic -> i_send_hdrs = NULL ;
875
- ic -> i_send_hdrs_dma = NULL ;
876
-
877
- ic -> i_recv_hdrs = NULL ;
878
- ic -> i_recv_hdrs_dma = NULL ;
879
-
880
- ic -> i_ack = NULL ;
881
- }
882
-
883
807
/*
884
808
* This needs to be very careful to not leave IS_ERR pointers around for
885
809
* cleanup to trip over.
@@ -1662,9 +1586,32 @@ void rds_ib_conn_path_shutdown(struct rds_conn_path *cp)
1662
1586
if (ic -> i_cm_id -> qp )
1663
1587
rdma_destroy_qp (ic -> i_cm_id );
1664
1588
1665
- /* then free the resources that ib callbacks use */
1666
1589
if (ic -> rds_ibdev ) {
1667
- rds_dma_hdrs_free_all (ic );
1590
+ struct dma_pool * pool ;
1591
+
1592
+ pool = ic -> rds_ibdev -> rid_hdrs_pool ;
1593
+
1594
+ /* then free the resources that ib callbacks use */
1595
+ if (ic -> i_send_hdrs ) {
1596
+ rds_dma_hdrs_free (pool , ic -> i_send_hdrs ,
1597
+ ic -> i_send_hdrs_dma ,
1598
+ ic -> i_send_ring .w_nr );
1599
+ ic -> i_send_hdrs = NULL ;
1600
+ ic -> i_send_hdrs_dma = NULL ;
1601
+ }
1602
+
1603
+ if (ic -> i_recv_hdrs ) {
1604
+ rds_dma_hdrs_free (pool , ic -> i_recv_hdrs ,
1605
+ ic -> i_recv_hdrs_dma ,
1606
+ ic -> i_recv_ring .w_nr );
1607
+ ic -> i_recv_hdrs = NULL ;
1608
+ ic -> i_recv_hdrs_dma = NULL ;
1609
+ }
1610
+
1611
+ if (ic -> i_ack ) {
1612
+ dma_pool_free (pool , ic -> i_ack , ic -> i_ack_dma );
1613
+ ic -> i_ack = NULL ;
1614
+ }
1668
1615
} else {
1669
1616
WARN_ON (ic -> i_send_hdrs );
1670
1617
WARN_ON (ic -> i_send_hdrs_dma );
0 commit comments