@@ -732,6 +732,8 @@ static int fec_enet_txq_submit_tso(struct fec_enet_priv_tx_q *txq,
732
732
int hdr_len = skb_transport_offset (skb ) + tcp_hdrlen (skb );
733
733
int total_len , data_left ;
734
734
struct bufdesc * bdp = txq -> bd .cur ;
735
+ struct bufdesc * tmp_bdp ;
736
+ struct bufdesc_ex * ebdp ;
735
737
struct tso_t tso ;
736
738
unsigned int index = 0 ;
737
739
int ret ;
@@ -805,7 +807,34 @@ static int fec_enet_txq_submit_tso(struct fec_enet_priv_tx_q *txq,
805
807
return 0 ;
806
808
807
809
err_release :
808
- /* TODO: Release all used data descriptors for TSO */
810
+ /* Release all used data descriptors for TSO */
811
+ tmp_bdp = txq -> bd .cur ;
812
+
813
+ while (tmp_bdp != bdp ) {
814
+ /* Unmap data buffers */
815
+ if (tmp_bdp -> cbd_bufaddr &&
816
+ !IS_TSO_HEADER (txq , fec32_to_cpu (tmp_bdp -> cbd_bufaddr )))
817
+ dma_unmap_single (& fep -> pdev -> dev ,
818
+ fec32_to_cpu (tmp_bdp -> cbd_bufaddr ),
819
+ fec16_to_cpu (tmp_bdp -> cbd_datlen ),
820
+ DMA_TO_DEVICE );
821
+
822
+ /* Clear standard buffer descriptor fields */
823
+ tmp_bdp -> cbd_sc = 0 ;
824
+ tmp_bdp -> cbd_datlen = 0 ;
825
+ tmp_bdp -> cbd_bufaddr = 0 ;
826
+
827
+ /* Handle extended descriptor if enabled */
828
+ if (fep -> bufdesc_ex ) {
829
+ ebdp = (struct bufdesc_ex * )tmp_bdp ;
830
+ ebdp -> cbd_esc = 0 ;
831
+ }
832
+
833
+ tmp_bdp = fec_enet_get_nextdesc (tmp_bdp , & txq -> bd );
834
+ }
835
+
836
+ dev_kfree_skb_any (skb );
837
+
809
838
return ret ;
810
839
}
811
840
0 commit comments