@@ -559,15 +559,20 @@ static int xsc_eth_open_qp_sq(struct xsc_channel *c,
559
559
u8 ele_log_size = psq_param -> sq_attr .ele_log_size ;
560
560
u8 q_log_size = psq_param -> sq_attr .q_log_size ;
561
561
struct xsc_modify_raw_qp_mbox_in * modify_in ;
562
+ struct xsc_channel_stats * channel_stats ;
562
563
struct xsc_create_qp_mbox_in * in ;
563
564
struct xsc_core_device * xdev ;
564
565
struct xsc_adapter * adapter ;
566
+ struct xsc_stats * stats ;
565
567
unsigned int hw_npages ;
566
568
int inlen ;
567
569
int ret ;
568
570
569
571
adapter = c -> adapter ;
570
572
xdev = adapter -> xdev ;
573
+ stats = adapter -> stats ;
574
+ channel_stats = & stats -> channel_stats [c -> chl_idx ];
575
+ psq -> stats = & channel_stats -> sq [sq_idx ];
571
576
psq_param -> wq .db_numa_node = cpu_to_node (c -> cpu );
572
577
573
578
ret = xsc_eth_wq_cyc_create (xdev , & psq_param -> wq ,
@@ -868,11 +873,16 @@ static int xsc_eth_alloc_rq(struct xsc_channel *c,
868
873
u8 q_log_size = prq_param -> rq_attr .q_log_size ;
869
874
struct page_pool_params pagepool_params = {0 };
870
875
struct xsc_adapter * adapter = c -> adapter ;
876
+ struct xsc_channel_stats * channel_stats ;
871
877
u32 pool_size = 1 << q_log_size ;
878
+ struct xsc_stats * stats ;
872
879
int ret = 0 ;
873
880
u32 wq_sz ;
874
881
int i , f ;
875
882
883
+ stats = c -> adapter -> stats ;
884
+ channel_stats = & stats -> channel_stats [c -> chl_idx ];
885
+ prq -> stats = & channel_stats -> rq ;
876
886
prq_param -> wq .db_numa_node = cpu_to_node (c -> cpu );
877
887
878
888
ret = xsc_eth_wq_cyc_create (c -> adapter -> xdev , & prq_param -> wq ,
@@ -1653,6 +1663,14 @@ static int xsc_eth_close(struct net_device *netdev)
1653
1663
return ret ;
1654
1664
}
1655
1665
1666
+ static void xsc_eth_get_stats (struct net_device * netdev ,
1667
+ struct rtnl_link_stats64 * stats )
1668
+ {
1669
+ struct xsc_adapter * adapter = netdev_priv (netdev );
1670
+
1671
+ xsc_eth_fold_sw_stats64 (adapter , stats );
1672
+ }
1673
+
1656
1674
static int xsc_eth_set_hw_mtu (struct xsc_core_device * xdev ,
1657
1675
u16 mtu , u16 rx_buf_sz )
1658
1676
{
@@ -1684,6 +1702,7 @@ static const struct net_device_ops xsc_netdev_ops = {
1684
1702
.ndo_open = xsc_eth_open ,
1685
1703
.ndo_stop = xsc_eth_close ,
1686
1704
.ndo_start_xmit = xsc_eth_xmit_start ,
1705
+ .ndo_get_stats64 = xsc_eth_get_stats ,
1687
1706
};
1688
1707
1689
1708
static void xsc_eth_build_nic_netdev (struct xsc_adapter * adapter )
@@ -1897,14 +1916,22 @@ static int xsc_eth_probe(struct auxiliary_device *adev,
1897
1916
goto err_nic_cleanup ;
1898
1917
}
1899
1918
1919
+ adapter -> stats = kvzalloc (sizeof (* adapter -> stats ), GFP_KERNEL );
1920
+ if (!adapter -> stats ) {
1921
+ err = - ENOMEM ;
1922
+ goto err_detach ;
1923
+ }
1924
+
1900
1925
err = register_netdev (netdev );
1901
1926
if (err ) {
1902
1927
netdev_err (netdev , "register_netdev failed, err=%d\n" , err );
1903
- goto err_detach ;
1928
+ goto err_free_stats ;
1904
1929
}
1905
1930
1906
1931
return 0 ;
1907
1932
1933
+ err_free_stats :
1934
+ kvfree (adapter -> stats );
1908
1935
err_detach :
1909
1936
xsc_eth_detach (xdev , adapter );
1910
1937
err_nic_cleanup :
@@ -1929,7 +1956,7 @@ static void xsc_eth_remove(struct auxiliary_device *adev)
1929
1956
return ;
1930
1957
1931
1958
unregister_netdev (adapter -> netdev );
1932
-
1959
+ kvfree ( adapter -> stats );
1933
1960
free_netdev (adapter -> netdev );
1934
1961
1935
1962
xdev -> eth_priv = NULL ;
0 commit comments