@@ -187,7 +187,6 @@ int emac_tx_complete_packets(struct prueth_emac *emac, int chn,
187
187
xdp_return_frame (xdpf );
188
188
break ;
189
189
default :
190
- netdev_err (ndev , "tx_complete: invalid swdata type %d\n" , swdata -> type );
191
190
prueth_xmit_free (tx_chn , desc_tx );
192
191
ndev -> stats .tx_dropped ++ ;
193
192
continue ;
@@ -567,6 +566,7 @@ u32 emac_xmit_xdp_frame(struct prueth_emac *emac,
567
566
{
568
567
struct cppi5_host_desc_t * first_desc ;
569
568
struct net_device * ndev = emac -> ndev ;
569
+ struct netdev_queue * netif_txq ;
570
570
struct prueth_tx_chn * tx_chn ;
571
571
dma_addr_t desc_dma , buf_dma ;
572
572
struct prueth_swdata * swdata ;
@@ -620,12 +620,17 @@ u32 emac_xmit_xdp_frame(struct prueth_emac *emac,
620
620
swdata -> data .xdpf = xdpf ;
621
621
}
622
622
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
+
623
627
cppi5_hdesc_set_pktlen (first_desc , xdpf -> len );
624
628
desc_dma = k3_cppi_desc_pool_virt2dma (tx_chn -> desc_pool , first_desc );
625
629
626
630
ret = k3_udma_glue_push_tx_chn (tx_chn -> tx_chn , first_desc , desc_dma );
627
631
if (ret ) {
628
632
netdev_err (ndev , "xdp tx: push failed: %d\n" , ret );
633
+ netdev_tx_completed_queue (netif_txq , 1 , xdpf -> len );
629
634
goto drop_free_descs ;
630
635
}
631
636
@@ -650,6 +655,8 @@ static u32 emac_run_xdp(struct prueth_emac *emac, struct xdp_buff *xdp,
650
655
struct page * page , u32 * len )
651
656
{
652
657
struct net_device * ndev = emac -> ndev ;
658
+ struct netdev_queue * netif_txq ;
659
+ int cpu = smp_processor_id ();
653
660
struct bpf_prog * xdp_prog ;
654
661
struct xdp_frame * xdpf ;
655
662
u32 pkt_len = * len ;
@@ -669,8 +676,11 @@ static u32 emac_run_xdp(struct prueth_emac *emac, struct xdp_buff *xdp,
669
676
goto drop ;
670
677
}
671
678
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 );
673
682
result = emac_xmit_xdp_frame (emac , xdpf , page , q_idx );
683
+ __netif_tx_unlock (netif_txq );
674
684
if (result == ICSSG_XDP_CONSUMED ) {
675
685
ndev -> stats .tx_dropped ++ ;
676
686
goto drop ;
@@ -979,6 +989,7 @@ enum netdev_tx icssg_ndo_start_xmit(struct sk_buff *skb, struct net_device *ndev
979
989
ret = k3_udma_glue_push_tx_chn (tx_chn -> tx_chn , first_desc , desc_dma );
980
990
if (ret ) {
981
991
netdev_err (ndev , "tx: push failed: %d\n" , ret );
992
+ netdev_tx_completed_queue (netif_txq , 1 , pkt_len );
982
993
goto drop_free_descs ;
983
994
}
984
995
0 commit comments