@@ -187,7 +187,6 @@ int emac_tx_complete_packets(struct prueth_emac *emac, int chn,
187187 xdp_return_frame (xdpf );
188188 break ;
189189 default :
190- netdev_err (ndev , "tx_complete: invalid swdata type %d\n" , swdata -> type );
191190 prueth_xmit_free (tx_chn , desc_tx );
192191 ndev -> stats .tx_dropped ++ ;
193192 continue ;
@@ -567,6 +566,7 @@ u32 emac_xmit_xdp_frame(struct prueth_emac *emac,
567566{
568567 struct cppi5_host_desc_t * first_desc ;
569568 struct net_device * ndev = emac -> ndev ;
569+ struct netdev_queue * netif_txq ;
570570 struct prueth_tx_chn * tx_chn ;
571571 dma_addr_t desc_dma , buf_dma ;
572572 struct prueth_swdata * swdata ;
@@ -620,12 +620,17 @@ u32 emac_xmit_xdp_frame(struct prueth_emac *emac,
620620 swdata -> data .xdpf = xdpf ;
621621 }
622622
623+ /* Report BQL before sending the packet */
624+ netif_txq = netdev_get_tx_queue (ndev , tx_chn -> id );
625+ netdev_tx_sent_queue (netif_txq , xdpf -> len );
626+
623627 cppi5_hdesc_set_pktlen (first_desc , xdpf -> len );
624628 desc_dma = k3_cppi_desc_pool_virt2dma (tx_chn -> desc_pool , first_desc );
625629
626630 ret = k3_udma_glue_push_tx_chn (tx_chn -> tx_chn , first_desc , desc_dma );
627631 if (ret ) {
628632 netdev_err (ndev , "xdp tx: push failed: %d\n" , ret );
633+ netdev_tx_completed_queue (netif_txq , 1 , xdpf -> len );
629634 goto drop_free_descs ;
630635 }
631636
@@ -650,6 +655,8 @@ static u32 emac_run_xdp(struct prueth_emac *emac, struct xdp_buff *xdp,
650655 struct page * page , u32 * len )
651656{
652657 struct net_device * ndev = emac -> ndev ;
658+ struct netdev_queue * netif_txq ;
659+ int cpu = smp_processor_id ();
653660 struct bpf_prog * xdp_prog ;
654661 struct xdp_frame * xdpf ;
655662 u32 pkt_len = * len ;
@@ -669,8 +676,11 @@ static u32 emac_run_xdp(struct prueth_emac *emac, struct xdp_buff *xdp,
669676 goto drop ;
670677 }
671678
672- q_idx = smp_processor_id () % emac -> tx_ch_num ;
679+ q_idx = cpu % emac -> tx_ch_num ;
680+ netif_txq = netdev_get_tx_queue (ndev , q_idx );
681+ __netif_tx_lock (netif_txq , cpu );
673682 result = emac_xmit_xdp_frame (emac , xdpf , page , q_idx );
683+ __netif_tx_unlock (netif_txq );
674684 if (result == ICSSG_XDP_CONSUMED ) {
675685 ndev -> stats .tx_dropped ++ ;
676686 goto drop ;
@@ -979,6 +989,7 @@ enum netdev_tx icssg_ndo_start_xmit(struct sk_buff *skb, struct net_device *ndev
979989 ret = k3_udma_glue_push_tx_chn (tx_chn -> tx_chn , first_desc , desc_dma );
980990 if (ret ) {
981991 netdev_err (ndev , "tx: push failed: %d\n" , ret );
992+ netdev_tx_completed_queue (netif_txq , 1 , pkt_len );
982993 goto drop_free_descs ;
983994 }
984995
0 commit comments