@@ -288,7 +288,7 @@ static void dpaa2_eth_rx(struct dpaa2_eth_priv *priv,
288
288
* Observance of NAPI budget is not our concern, leaving that to the caller.
289
289
*/
290
290
static int consume_frames (struct dpaa2_eth_channel * ch ,
291
- enum dpaa2_eth_fq_type * type )
291
+ struct dpaa2_eth_fq * * src )
292
292
{
293
293
struct dpaa2_eth_priv * priv = ch -> priv ;
294
294
struct dpaa2_eth_fq * fq = NULL ;
@@ -322,10 +322,10 @@ static int consume_frames(struct dpaa2_eth_channel *ch,
322
322
ch -> stats .frames += cleaned ;
323
323
324
324
/* A dequeue operation only pulls frames from a single queue
325
- * into the store. Return the frame queue type as an out param.
325
+ * into the store. Return the frame queue as an out param.
326
326
*/
327
- if (type )
328
- * type = fq -> type ;
327
+ if (src )
328
+ * src = fq ;
329
329
330
330
return cleaned ;
331
331
}
@@ -570,8 +570,10 @@ static netdev_tx_t dpaa2_eth_tx(struct sk_buff *skb, struct net_device *net_dev)
570
570
struct rtnl_link_stats64 * percpu_stats ;
571
571
struct dpaa2_eth_drv_stats * percpu_extras ;
572
572
struct dpaa2_eth_fq * fq ;
573
+ struct netdev_queue * nq ;
573
574
u16 queue_mapping ;
574
575
unsigned int needed_headroom ;
576
+ u32 fd_len ;
575
577
int err , i ;
576
578
577
579
percpu_stats = this_cpu_ptr (priv -> percpu_stats );
@@ -643,8 +645,12 @@ static netdev_tx_t dpaa2_eth_tx(struct sk_buff *skb, struct net_device *net_dev)
643
645
/* Clean up everything, including freeing the skb */
644
646
free_tx_fd (priv , & fd );
645
647
} else {
648
+ fd_len = dpaa2_fd_get_len (& fd );
646
649
percpu_stats -> tx_packets ++ ;
647
- percpu_stats -> tx_bytes += dpaa2_fd_get_len (& fd );
650
+ percpu_stats -> tx_bytes += fd_len ;
651
+
652
+ nq = netdev_get_tx_queue (net_dev , queue_mapping );
653
+ netdev_tx_sent_queue (nq , fd_len );
648
654
}
649
655
650
656
return NETDEV_TX_OK ;
@@ -660,18 +666,22 @@ static netdev_tx_t dpaa2_eth_tx(struct sk_buff *skb, struct net_device *net_dev)
660
666
static void dpaa2_eth_tx_conf (struct dpaa2_eth_priv * priv ,
661
667
struct dpaa2_eth_channel * ch __always_unused ,
662
668
const struct dpaa2_fd * fd ,
663
- struct dpaa2_eth_fq * fq __always_unused )
669
+ struct dpaa2_eth_fq * fq )
664
670
{
665
671
struct rtnl_link_stats64 * percpu_stats ;
666
672
struct dpaa2_eth_drv_stats * percpu_extras ;
673
+ u32 fd_len = dpaa2_fd_get_len (fd );
667
674
u32 fd_errors ;
668
675
669
676
/* Tracing point */
670
677
trace_dpaa2_tx_conf_fd (priv -> net_dev , fd );
671
678
672
679
percpu_extras = this_cpu_ptr (priv -> percpu_extras );
673
680
percpu_extras -> tx_conf_frames ++ ;
674
- percpu_extras -> tx_conf_bytes += dpaa2_fd_get_len (fd );
681
+ percpu_extras -> tx_conf_bytes += fd_len ;
682
+
683
+ fq -> dq_frames ++ ;
684
+ fq -> dq_bytes += fd_len ;
675
685
676
686
/* Check frame errors in the FD field */
677
687
fd_errors = dpaa2_fd_get_ctrl (fd ) & DPAA2_FD_TX_ERR_MASK ;
@@ -932,8 +942,9 @@ static int dpaa2_eth_poll(struct napi_struct *napi, int budget)
932
942
struct dpaa2_eth_channel * ch ;
933
943
struct dpaa2_eth_priv * priv ;
934
944
int rx_cleaned = 0 , txconf_cleaned = 0 ;
935
- enum dpaa2_eth_fq_type type = 0 ;
936
- int store_cleaned ;
945
+ struct dpaa2_eth_fq * fq , * txc_fq = NULL ;
946
+ struct netdev_queue * nq ;
947
+ int store_cleaned , work_done ;
937
948
int err ;
938
949
939
950
ch = container_of (napi , struct dpaa2_eth_channel , napi );
@@ -947,18 +958,25 @@ static int dpaa2_eth_poll(struct napi_struct *napi, int budget)
947
958
/* Refill pool if appropriate */
948
959
refill_pool (priv , ch , priv -> bpid );
949
960
950
- store_cleaned = consume_frames (ch , & type );
951
- if (type == DPAA2_RX_FQ )
961
+ store_cleaned = consume_frames (ch , & fq );
962
+ if (!store_cleaned )
963
+ break ;
964
+ if (fq -> type == DPAA2_RX_FQ ) {
952
965
rx_cleaned += store_cleaned ;
953
- else
966
+ } else {
954
967
txconf_cleaned += store_cleaned ;
968
+ /* We have a single Tx conf FQ on this channel */
969
+ txc_fq = fq ;
970
+ }
955
971
956
972
/* If we either consumed the whole NAPI budget with Rx frames
957
973
* or we reached the Tx confirmations threshold, we're done.
958
974
*/
959
975
if (rx_cleaned >= budget ||
960
- txconf_cleaned >= DPAA2_ETH_TXCONF_PER_NAPI )
961
- return budget ;
976
+ txconf_cleaned >= DPAA2_ETH_TXCONF_PER_NAPI ) {
977
+ work_done = budget ;
978
+ goto out ;
979
+ }
962
980
} while (store_cleaned );
963
981
964
982
/* We didn't consume the entire budget, so finish napi and
@@ -972,7 +990,18 @@ static int dpaa2_eth_poll(struct napi_struct *napi, int budget)
972
990
WARN_ONCE (err , "CDAN notifications rearm failed on core %d" ,
973
991
ch -> nctx .desired_cpu );
974
992
975
- return max (rx_cleaned , 1 );
993
+ work_done = max (rx_cleaned , 1 );
994
+
995
+ out :
996
+ if (txc_fq ) {
997
+ nq = netdev_get_tx_queue (priv -> net_dev , txc_fq -> flowid );
998
+ netdev_tx_completed_queue (nq , txc_fq -> dq_frames ,
999
+ txc_fq -> dq_bytes );
1000
+ txc_fq -> dq_frames = 0 ;
1001
+ txc_fq -> dq_bytes = 0 ;
1002
+ }
1003
+
1004
+ return work_done ;
976
1005
}
977
1006
978
1007
static void enable_ch_napi (struct dpaa2_eth_priv * priv )
0 commit comments