@@ -840,6 +840,8 @@ static int fec_enet_txq_submit_tso(struct fec_enet_priv_tx_q *txq,
840
840
struct fec_enet_private * fep = netdev_priv (ndev );
841
841
int hdr_len , total_len , data_left ;
842
842
struct bufdesc * bdp = txq -> bd .cur ;
843
+ struct bufdesc * tmp_bdp ;
844
+ struct bufdesc_ex * ebdp ;
843
845
struct tso_t tso ;
844
846
unsigned int index = 0 ;
845
847
int ret ;
@@ -913,7 +915,34 @@ static int fec_enet_txq_submit_tso(struct fec_enet_priv_tx_q *txq,
913
915
return 0 ;
914
916
915
917
err_release :
916
- /* TODO: Release all used data descriptors for TSO */
918
+ /* Release all used data descriptors for TSO */
919
+ tmp_bdp = txq -> bd .cur ;
920
+
921
+ while (tmp_bdp != bdp ) {
922
+ /* Unmap data buffers */
923
+ if (tmp_bdp -> cbd_bufaddr &&
924
+ !IS_TSO_HEADER (txq , fec32_to_cpu (tmp_bdp -> cbd_bufaddr )))
925
+ dma_unmap_single (& fep -> pdev -> dev ,
926
+ fec32_to_cpu (tmp_bdp -> cbd_bufaddr ),
927
+ fec16_to_cpu (tmp_bdp -> cbd_datlen ),
928
+ DMA_TO_DEVICE );
929
+
930
+ /* Clear standard buffer descriptor fields */
931
+ tmp_bdp -> cbd_sc = 0 ;
932
+ tmp_bdp -> cbd_datlen = 0 ;
933
+ tmp_bdp -> cbd_bufaddr = 0 ;
934
+
935
+ /* Handle extended descriptor if enabled */
936
+ if (fep -> bufdesc_ex ) {
937
+ ebdp = (struct bufdesc_ex * )tmp_bdp ;
938
+ ebdp -> cbd_esc = 0 ;
939
+ }
940
+
941
+ tmp_bdp = fec_enet_get_nextdesc (tmp_bdp , & txq -> bd );
942
+ }
943
+
944
+ dev_kfree_skb_any (skb );
945
+
917
946
return ret ;
918
947
}
919
948
0 commit comments