All of lore.kernel.org
 help / color / mirror / Atom feed
* drivers/net/ethernet/google/gve/gve_ethtool.c:331 gve_get_ethtool_stats() warn: we never enter this loop
@ 2021-07-23 11:19 kernel test robot
  0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2021-07-23 11:19 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 19836 bytes --]

CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: David Awogbemila <awogbemila@google.com>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   8baef6386baaefb776bdd09b5c7630cf057c51c6
commit: 2f523dc34ac8c355609e9b847852bf25bbdb30bf gve: NIC stats for report-stats and for ethtool
date:   11 months ago
:::::: branch date: 8 hours ago
:::::: commit date: 11 months ago
config: x86_64-randconfig-m001-20210723 (attached as .config)
compiler: gcc-10 (Ubuntu 10.3.0-1ubuntu1~20.04) 10.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
drivers/net/ethernet/google/gve/gve_ethtool.c:331 gve_get_ethtool_stats() warn: we never enter this loop

vim +331 drivers/net/ethernet/google/gve/gve_ethtool.c

e5b845dc79838e Catherine Sullivan 2019-07-01  134  
e5b845dc79838e Catherine Sullivan 2019-07-01  135  static void
e5b845dc79838e Catherine Sullivan 2019-07-01  136  gve_get_ethtool_stats(struct net_device *netdev,
e5b845dc79838e Catherine Sullivan 2019-07-01  137  		      struct ethtool_stats *stats, u64 *data)
e5b845dc79838e Catherine Sullivan 2019-07-01  138  {
433e274b8f7b03 Kuo Zhao           2020-09-11  139  	u64 tmp_rx_pkts, tmp_rx_bytes, tmp_rx_skb_alloc_fail,	tmp_rx_buf_alloc_fail,
433e274b8f7b03 Kuo Zhao           2020-09-11  140  		tmp_rx_desc_err_dropped_pkt, tmp_tx_pkts, tmp_tx_bytes;
433e274b8f7b03 Kuo Zhao           2020-09-11  141  	u64 rx_buf_alloc_fail, rx_desc_err_dropped_pkt, rx_pkts,
433e274b8f7b03 Kuo Zhao           2020-09-11  142  		rx_skb_alloc_fail, rx_bytes, tx_pkts, tx_bytes;
2f523dc34ac8c3 David Awogbemila   2020-09-11  143  	int stats_idx, base_stats_idx, max_stats_idx;
2f523dc34ac8c3 David Awogbemila   2020-09-11  144  	struct stats *report_stats;
2f523dc34ac8c3 David Awogbemila   2020-09-11  145  	int *rx_qid_to_stats_idx;
2f523dc34ac8c3 David Awogbemila   2020-09-11  146  	int *tx_qid_to_stats_idx;
433e274b8f7b03 Kuo Zhao           2020-09-11  147  	struct gve_priv *priv;
2f523dc34ac8c3 David Awogbemila   2020-09-11  148  	bool skip_nic_stats;
e5b845dc79838e Catherine Sullivan 2019-07-01  149  	unsigned int start;
e5b845dc79838e Catherine Sullivan 2019-07-01  150  	int ring;
2f523dc34ac8c3 David Awogbemila   2020-09-11  151  	int i, j;
e5b845dc79838e Catherine Sullivan 2019-07-01  152  
e5b845dc79838e Catherine Sullivan 2019-07-01  153  	ASSERT_RTNL();
e5b845dc79838e Catherine Sullivan 2019-07-01  154  
433e274b8f7b03 Kuo Zhao           2020-09-11  155  	priv = netdev_priv(netdev);
2f523dc34ac8c3 David Awogbemila   2020-09-11  156  	report_stats = priv->stats_report->stats;
2f523dc34ac8c3 David Awogbemila   2020-09-11  157  	rx_qid_to_stats_idx = kmalloc_array(priv->rx_cfg.num_queues,
2f523dc34ac8c3 David Awogbemila   2020-09-11  158  					    sizeof(int), GFP_KERNEL);
2f523dc34ac8c3 David Awogbemila   2020-09-11  159  	if (!rx_qid_to_stats_idx)
2f523dc34ac8c3 David Awogbemila   2020-09-11  160  		return;
2f523dc34ac8c3 David Awogbemila   2020-09-11  161  	tx_qid_to_stats_idx = kmalloc_array(priv->tx_cfg.num_queues,
2f523dc34ac8c3 David Awogbemila   2020-09-11  162  					    sizeof(int), GFP_KERNEL);
2f523dc34ac8c3 David Awogbemila   2020-09-11  163  	if (!tx_qid_to_stats_idx) {
2f523dc34ac8c3 David Awogbemila   2020-09-11  164  		kfree(rx_qid_to_stats_idx);
2f523dc34ac8c3 David Awogbemila   2020-09-11  165  		return;
2f523dc34ac8c3 David Awogbemila   2020-09-11  166  	}
433e274b8f7b03 Kuo Zhao           2020-09-11  167  	for (rx_pkts = 0, rx_bytes = 0, rx_skb_alloc_fail = 0,
433e274b8f7b03 Kuo Zhao           2020-09-11  168  	     rx_buf_alloc_fail = 0, rx_desc_err_dropped_pkt = 0, ring = 0;
e5b845dc79838e Catherine Sullivan 2019-07-01  169  	     ring < priv->rx_cfg.num_queues; ring++) {
e5b845dc79838e Catherine Sullivan 2019-07-01  170  		if (priv->rx) {
e5b845dc79838e Catherine Sullivan 2019-07-01  171  			do {
433e274b8f7b03 Kuo Zhao           2020-09-11  172  				struct gve_rx_ring *rx = &priv->rx[ring];
433e274b8f7b03 Kuo Zhao           2020-09-11  173  
3c13ce74b6f885 Catherine Sullivan 2019-07-02  174  				start =
e5b845dc79838e Catherine Sullivan 2019-07-01  175  				  u64_stats_fetch_begin(&priv->rx[ring].statss);
433e274b8f7b03 Kuo Zhao           2020-09-11  176  				tmp_rx_pkts = rx->rpackets;
433e274b8f7b03 Kuo Zhao           2020-09-11  177  				tmp_rx_bytes = rx->rbytes;
433e274b8f7b03 Kuo Zhao           2020-09-11  178  				tmp_rx_skb_alloc_fail = rx->rx_skb_alloc_fail;
433e274b8f7b03 Kuo Zhao           2020-09-11  179  				tmp_rx_buf_alloc_fail = rx->rx_buf_alloc_fail;
433e274b8f7b03 Kuo Zhao           2020-09-11  180  				tmp_rx_desc_err_dropped_pkt =
433e274b8f7b03 Kuo Zhao           2020-09-11  181  					rx->rx_desc_err_dropped_pkt;
e5b845dc79838e Catherine Sullivan 2019-07-01  182  			} while (u64_stats_fetch_retry(&priv->rx[ring].statss,
e5b845dc79838e Catherine Sullivan 2019-07-01  183  						       start));
433e274b8f7b03 Kuo Zhao           2020-09-11  184  			rx_pkts += tmp_rx_pkts;
433e274b8f7b03 Kuo Zhao           2020-09-11  185  			rx_bytes += tmp_rx_bytes;
433e274b8f7b03 Kuo Zhao           2020-09-11  186  			rx_skb_alloc_fail += tmp_rx_skb_alloc_fail;
433e274b8f7b03 Kuo Zhao           2020-09-11  187  			rx_buf_alloc_fail += tmp_rx_buf_alloc_fail;
433e274b8f7b03 Kuo Zhao           2020-09-11  188  			rx_desc_err_dropped_pkt += tmp_rx_desc_err_dropped_pkt;
e5b845dc79838e Catherine Sullivan 2019-07-01  189  		}
e5b845dc79838e Catherine Sullivan 2019-07-01  190  	}
e5b845dc79838e Catherine Sullivan 2019-07-01  191  	for (tx_pkts = 0, tx_bytes = 0, ring = 0;
e5b845dc79838e Catherine Sullivan 2019-07-01  192  	     ring < priv->tx_cfg.num_queues; ring++) {
e5b845dc79838e Catherine Sullivan 2019-07-01  193  		if (priv->tx) {
e5b845dc79838e Catherine Sullivan 2019-07-01  194  			do {
3c13ce74b6f885 Catherine Sullivan 2019-07-02  195  				start =
e5b845dc79838e Catherine Sullivan 2019-07-01  196  				  u64_stats_fetch_begin(&priv->tx[ring].statss);
433e274b8f7b03 Kuo Zhao           2020-09-11  197  				tmp_tx_pkts = priv->tx[ring].pkt_done;
433e274b8f7b03 Kuo Zhao           2020-09-11  198  				tmp_tx_bytes = priv->tx[ring].bytes_done;
e5b845dc79838e Catherine Sullivan 2019-07-01  199  			} while (u64_stats_fetch_retry(&priv->tx[ring].statss,
e5b845dc79838e Catherine Sullivan 2019-07-01  200  						       start));
433e274b8f7b03 Kuo Zhao           2020-09-11  201  			tx_pkts += tmp_tx_pkts;
433e274b8f7b03 Kuo Zhao           2020-09-11  202  			tx_bytes += tmp_tx_bytes;
e5b845dc79838e Catherine Sullivan 2019-07-01  203  		}
e5b845dc79838e Catherine Sullivan 2019-07-01  204  	}
e5b845dc79838e Catherine Sullivan 2019-07-01  205  
e5b845dc79838e Catherine Sullivan 2019-07-01  206  	i = 0;
e5b845dc79838e Catherine Sullivan 2019-07-01  207  	data[i++] = rx_pkts;
e5b845dc79838e Catherine Sullivan 2019-07-01  208  	data[i++] = tx_pkts;
e5b845dc79838e Catherine Sullivan 2019-07-01  209  	data[i++] = rx_bytes;
e5b845dc79838e Catherine Sullivan 2019-07-01  210  	data[i++] = tx_bytes;
433e274b8f7b03 Kuo Zhao           2020-09-11  211  	/* total rx dropped packets */
433e274b8f7b03 Kuo Zhao           2020-09-11  212  	data[i++] = rx_skb_alloc_fail + rx_buf_alloc_fail +
433e274b8f7b03 Kuo Zhao           2020-09-11  213  		    rx_desc_err_dropped_pkt;
433e274b8f7b03 Kuo Zhao           2020-09-11  214  	/* Skip tx_dropped */
433e274b8f7b03 Kuo Zhao           2020-09-11  215  	i++;
433e274b8f7b03 Kuo Zhao           2020-09-11  216  
e5b845dc79838e Catherine Sullivan 2019-07-01  217  	data[i++] = priv->tx_timeo_cnt;
433e274b8f7b03 Kuo Zhao           2020-09-11  218  	data[i++] = rx_skb_alloc_fail;
433e274b8f7b03 Kuo Zhao           2020-09-11  219  	data[i++] = rx_buf_alloc_fail;
433e274b8f7b03 Kuo Zhao           2020-09-11  220  	data[i++] = rx_desc_err_dropped_pkt;
433e274b8f7b03 Kuo Zhao           2020-09-11  221  	data[i++] = priv->interface_up_cnt;
433e274b8f7b03 Kuo Zhao           2020-09-11  222  	data[i++] = priv->interface_down_cnt;
433e274b8f7b03 Kuo Zhao           2020-09-11  223  	data[i++] = priv->reset_cnt;
433e274b8f7b03 Kuo Zhao           2020-09-11  224  	data[i++] = priv->page_alloc_fail;
433e274b8f7b03 Kuo Zhao           2020-09-11  225  	data[i++] = priv->dma_mapping_error;
24aeb56f2d38ed Kuo Zhao           2020-09-11  226  	data[i++] = priv->stats_report_trigger_cnt;
e5b845dc79838e Catherine Sullivan 2019-07-01  227  	i = GVE_MAIN_STATS_LEN;
e5b845dc79838e Catherine Sullivan 2019-07-01  228  
2f523dc34ac8c3 David Awogbemila   2020-09-11  229  	/* For rx cross-reporting stats, start from nic rx stats in report */
2f523dc34ac8c3 David Awogbemila   2020-09-11  230  	base_stats_idx = GVE_TX_STATS_REPORT_NUM * priv->tx_cfg.num_queues +
2f523dc34ac8c3 David Awogbemila   2020-09-11  231  		GVE_RX_STATS_REPORT_NUM * priv->rx_cfg.num_queues;
2f523dc34ac8c3 David Awogbemila   2020-09-11  232  	max_stats_idx = NIC_RX_STATS_REPORT_NUM * priv->rx_cfg.num_queues +
2f523dc34ac8c3 David Awogbemila   2020-09-11  233  		base_stats_idx;
2f523dc34ac8c3 David Awogbemila   2020-09-11  234  	/* Preprocess the stats report for rx, map queue id to start index */
2f523dc34ac8c3 David Awogbemila   2020-09-11  235  	skip_nic_stats = false;
2f523dc34ac8c3 David Awogbemila   2020-09-11  236  	for (stats_idx = base_stats_idx; stats_idx < max_stats_idx;
2f523dc34ac8c3 David Awogbemila   2020-09-11  237  		stats_idx += NIC_RX_STATS_REPORT_NUM) {
2f523dc34ac8c3 David Awogbemila   2020-09-11  238  		u32 stat_name = be32_to_cpu(report_stats[stats_idx].stat_name);
2f523dc34ac8c3 David Awogbemila   2020-09-11  239  		u32 queue_id = be32_to_cpu(report_stats[stats_idx].queue_id);
2f523dc34ac8c3 David Awogbemila   2020-09-11  240  
2f523dc34ac8c3 David Awogbemila   2020-09-11  241  		if (stat_name == 0) {
2f523dc34ac8c3 David Awogbemila   2020-09-11  242  			/* no stats written by NIC yet */
2f523dc34ac8c3 David Awogbemila   2020-09-11  243  			skip_nic_stats = true;
2f523dc34ac8c3 David Awogbemila   2020-09-11  244  			break;
2f523dc34ac8c3 David Awogbemila   2020-09-11  245  		}
2f523dc34ac8c3 David Awogbemila   2020-09-11  246  		rx_qid_to_stats_idx[queue_id] = stats_idx;
2f523dc34ac8c3 David Awogbemila   2020-09-11  247  	}
e5b845dc79838e Catherine Sullivan 2019-07-01  248  	/* walk RX rings */
e5b845dc79838e Catherine Sullivan 2019-07-01  249  	if (priv->rx) {
e5b845dc79838e Catherine Sullivan 2019-07-01  250  		for (ring = 0; ring < priv->rx_cfg.num_queues; ring++) {
e5b845dc79838e Catherine Sullivan 2019-07-01  251  			struct gve_rx_ring *rx = &priv->rx[ring];
e5b845dc79838e Catherine Sullivan 2019-07-01  252  
438b43bdb95d31 Catherine Sullivan 2019-08-01  253  			data[i++] = rx->fill_cnt;
433e274b8f7b03 Kuo Zhao           2020-09-11  254  			data[i++] = rx->cnt;
433e274b8f7b03 Kuo Zhao           2020-09-11  255  			do {
433e274b8f7b03 Kuo Zhao           2020-09-11  256  				start =
433e274b8f7b03 Kuo Zhao           2020-09-11  257  				  u64_stats_fetch_begin(&priv->rx[ring].statss);
433e274b8f7b03 Kuo Zhao           2020-09-11  258  				tmp_rx_bytes = rx->rbytes;
433e274b8f7b03 Kuo Zhao           2020-09-11  259  				tmp_rx_skb_alloc_fail = rx->rx_skb_alloc_fail;
433e274b8f7b03 Kuo Zhao           2020-09-11  260  				tmp_rx_buf_alloc_fail = rx->rx_buf_alloc_fail;
433e274b8f7b03 Kuo Zhao           2020-09-11  261  				tmp_rx_desc_err_dropped_pkt =
433e274b8f7b03 Kuo Zhao           2020-09-11  262  					rx->rx_desc_err_dropped_pkt;
433e274b8f7b03 Kuo Zhao           2020-09-11  263  			} while (u64_stats_fetch_retry(&priv->rx[ring].statss,
433e274b8f7b03 Kuo Zhao           2020-09-11  264  						       start));
433e274b8f7b03 Kuo Zhao           2020-09-11  265  			data[i++] = tmp_rx_bytes;
433e274b8f7b03 Kuo Zhao           2020-09-11  266  			/* rx dropped packets */
433e274b8f7b03 Kuo Zhao           2020-09-11  267  			data[i++] = tmp_rx_skb_alloc_fail +
433e274b8f7b03 Kuo Zhao           2020-09-11  268  				tmp_rx_buf_alloc_fail +
433e274b8f7b03 Kuo Zhao           2020-09-11  269  				tmp_rx_desc_err_dropped_pkt;
433e274b8f7b03 Kuo Zhao           2020-09-11  270  			data[i++] = rx->rx_copybreak_pkt;
433e274b8f7b03 Kuo Zhao           2020-09-11  271  			data[i++] = rx->rx_copied_pkt;
2f523dc34ac8c3 David Awogbemila   2020-09-11  272  			/* stats from NIC */
2f523dc34ac8c3 David Awogbemila   2020-09-11  273  			if (skip_nic_stats) {
2f523dc34ac8c3 David Awogbemila   2020-09-11  274  				/* skip NIC rx stats */
2f523dc34ac8c3 David Awogbemila   2020-09-11  275  				i += NIC_RX_STATS_REPORT_NUM;
2f523dc34ac8c3 David Awogbemila   2020-09-11  276  				continue;
2f523dc34ac8c3 David Awogbemila   2020-09-11  277  			}
2f523dc34ac8c3 David Awogbemila   2020-09-11  278  			for (j = 0; j < NIC_RX_STATS_REPORT_NUM; j++) {
2f523dc34ac8c3 David Awogbemila   2020-09-11  279  				u64 value =
2f523dc34ac8c3 David Awogbemila   2020-09-11  280  				be64_to_cpu(report_stats[rx_qid_to_stats_idx[ring] + j].value);
2f523dc34ac8c3 David Awogbemila   2020-09-11  281  
2f523dc34ac8c3 David Awogbemila   2020-09-11  282  				data[i++] = value;
2f523dc34ac8c3 David Awogbemila   2020-09-11  283  			}
e5b845dc79838e Catherine Sullivan 2019-07-01  284  		}
e5b845dc79838e Catherine Sullivan 2019-07-01  285  	} else {
e5b845dc79838e Catherine Sullivan 2019-07-01  286  		i += priv->rx_cfg.num_queues * NUM_GVE_RX_CNTS;
e5b845dc79838e Catherine Sullivan 2019-07-01  287  	}
2f523dc34ac8c3 David Awogbemila   2020-09-11  288  
2f523dc34ac8c3 David Awogbemila   2020-09-11  289  	/* For tx cross-reporting stats, start from nic tx stats in report */
2f523dc34ac8c3 David Awogbemila   2020-09-11  290  	base_stats_idx = max_stats_idx;
2f523dc34ac8c3 David Awogbemila   2020-09-11  291  	max_stats_idx = NIC_TX_STATS_REPORT_NUM * priv->tx_cfg.num_queues +
2f523dc34ac8c3 David Awogbemila   2020-09-11  292  		max_stats_idx;
2f523dc34ac8c3 David Awogbemila   2020-09-11  293  	/* Preprocess the stats report for tx, map queue id to start index */
2f523dc34ac8c3 David Awogbemila   2020-09-11  294  	skip_nic_stats = false;
2f523dc34ac8c3 David Awogbemila   2020-09-11  295  	for (stats_idx = base_stats_idx; stats_idx < max_stats_idx;
2f523dc34ac8c3 David Awogbemila   2020-09-11  296  		stats_idx += NIC_TX_STATS_REPORT_NUM) {
2f523dc34ac8c3 David Awogbemila   2020-09-11  297  		u32 stat_name = be32_to_cpu(report_stats[stats_idx].stat_name);
2f523dc34ac8c3 David Awogbemila   2020-09-11  298  		u32 queue_id = be32_to_cpu(report_stats[stats_idx].queue_id);
2f523dc34ac8c3 David Awogbemila   2020-09-11  299  
2f523dc34ac8c3 David Awogbemila   2020-09-11  300  		if (stat_name == 0) {
2f523dc34ac8c3 David Awogbemila   2020-09-11  301  			/* no stats written by NIC yet */
2f523dc34ac8c3 David Awogbemila   2020-09-11  302  			skip_nic_stats = true;
2f523dc34ac8c3 David Awogbemila   2020-09-11  303  			break;
2f523dc34ac8c3 David Awogbemila   2020-09-11  304  		}
2f523dc34ac8c3 David Awogbemila   2020-09-11  305  		tx_qid_to_stats_idx[queue_id] = stats_idx;
2f523dc34ac8c3 David Awogbemila   2020-09-11  306  	}
e5b845dc79838e Catherine Sullivan 2019-07-01  307  	/* walk TX rings */
e5b845dc79838e Catherine Sullivan 2019-07-01  308  	if (priv->tx) {
e5b845dc79838e Catherine Sullivan 2019-07-01  309  		for (ring = 0; ring < priv->tx_cfg.num_queues; ring++) {
e5b845dc79838e Catherine Sullivan 2019-07-01  310  			struct gve_tx_ring *tx = &priv->tx[ring];
e5b845dc79838e Catherine Sullivan 2019-07-01  311  
e5b845dc79838e Catherine Sullivan 2019-07-01  312  			data[i++] = tx->req;
e5b845dc79838e Catherine Sullivan 2019-07-01  313  			data[i++] = tx->done;
433e274b8f7b03 Kuo Zhao           2020-09-11  314  			do {
433e274b8f7b03 Kuo Zhao           2020-09-11  315  				start =
433e274b8f7b03 Kuo Zhao           2020-09-11  316  				  u64_stats_fetch_begin(&priv->tx[ring].statss);
433e274b8f7b03 Kuo Zhao           2020-09-11  317  				tmp_tx_bytes = tx->bytes_done;
433e274b8f7b03 Kuo Zhao           2020-09-11  318  			} while (u64_stats_fetch_retry(&priv->tx[ring].statss,
433e274b8f7b03 Kuo Zhao           2020-09-11  319  						       start));
433e274b8f7b03 Kuo Zhao           2020-09-11  320  			data[i++] = tmp_tx_bytes;
e5b845dc79838e Catherine Sullivan 2019-07-01  321  			data[i++] = tx->wake_queue;
e5b845dc79838e Catherine Sullivan 2019-07-01  322  			data[i++] = tx->stop_queue;
e5b845dc79838e Catherine Sullivan 2019-07-01  323  			data[i++] = be32_to_cpu(gve_tx_load_event_counter(priv,
e5b845dc79838e Catherine Sullivan 2019-07-01  324  									  tx));
2f523dc34ac8c3 David Awogbemila   2020-09-11  325  			/* stats from NIC */
2f523dc34ac8c3 David Awogbemila   2020-09-11  326  			if (skip_nic_stats) {
2f523dc34ac8c3 David Awogbemila   2020-09-11  327  				/* skip NIC tx stats */
2f523dc34ac8c3 David Awogbemila   2020-09-11  328  				i += NIC_TX_STATS_REPORT_NUM;
2f523dc34ac8c3 David Awogbemila   2020-09-11  329  				continue;
2f523dc34ac8c3 David Awogbemila   2020-09-11  330  			}
2f523dc34ac8c3 David Awogbemila   2020-09-11 @331  			for (j = 0; j < NIC_TX_STATS_REPORT_NUM; j++) {
2f523dc34ac8c3 David Awogbemila   2020-09-11  332  				u64 value =
2f523dc34ac8c3 David Awogbemila   2020-09-11  333  				be64_to_cpu(report_stats[tx_qid_to_stats_idx[ring] + j].value);
2f523dc34ac8c3 David Awogbemila   2020-09-11  334  				data[i++] = value;
2f523dc34ac8c3 David Awogbemila   2020-09-11  335  			}
e5b845dc79838e Catherine Sullivan 2019-07-01  336  		}
e5b845dc79838e Catherine Sullivan 2019-07-01  337  	} else {
e5b845dc79838e Catherine Sullivan 2019-07-01  338  		i += priv->tx_cfg.num_queues * NUM_GVE_TX_CNTS;
e5b845dc79838e Catherine Sullivan 2019-07-01  339  	}
2f523dc34ac8c3 David Awogbemila   2020-09-11  340  
2f523dc34ac8c3 David Awogbemila   2020-09-11  341  	kfree(rx_qid_to_stats_idx);
2f523dc34ac8c3 David Awogbemila   2020-09-11  342  	kfree(tx_qid_to_stats_idx);
433e274b8f7b03 Kuo Zhao           2020-09-11  343  	/* AQ Stats */
433e274b8f7b03 Kuo Zhao           2020-09-11  344  	data[i++] = priv->adminq_prod_cnt;
433e274b8f7b03 Kuo Zhao           2020-09-11  345  	data[i++] = priv->adminq_cmd_fail;
433e274b8f7b03 Kuo Zhao           2020-09-11  346  	data[i++] = priv->adminq_timeouts;
433e274b8f7b03 Kuo Zhao           2020-09-11  347  	data[i++] = priv->adminq_describe_device_cnt;
433e274b8f7b03 Kuo Zhao           2020-09-11  348  	data[i++] = priv->adminq_cfg_device_resources_cnt;
433e274b8f7b03 Kuo Zhao           2020-09-11  349  	data[i++] = priv->adminq_register_page_list_cnt;
433e274b8f7b03 Kuo Zhao           2020-09-11  350  	data[i++] = priv->adminq_unregister_page_list_cnt;
433e274b8f7b03 Kuo Zhao           2020-09-11  351  	data[i++] = priv->adminq_create_tx_queue_cnt;
433e274b8f7b03 Kuo Zhao           2020-09-11  352  	data[i++] = priv->adminq_create_rx_queue_cnt;
433e274b8f7b03 Kuo Zhao           2020-09-11  353  	data[i++] = priv->adminq_destroy_tx_queue_cnt;
433e274b8f7b03 Kuo Zhao           2020-09-11  354  	data[i++] = priv->adminq_destroy_rx_queue_cnt;
433e274b8f7b03 Kuo Zhao           2020-09-11  355  	data[i++] = priv->adminq_dcfg_device_resources_cnt;
433e274b8f7b03 Kuo Zhao           2020-09-11  356  	data[i++] = priv->adminq_set_driver_parameter_cnt;
24aeb56f2d38ed Kuo Zhao           2020-09-11  357  	data[i++] = priv->adminq_report_stats_cnt;
e5b845dc79838e Catherine Sullivan 2019-07-01  358  }
e5b845dc79838e Catherine Sullivan 2019-07-01  359  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 38904 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* drivers/net/ethernet/google/gve/gve_ethtool.c:331 gve_get_ethtool_stats() warn: we never enter this loop
@ 2021-08-08 11:34 kernel test robot
  0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2021-08-08 11:34 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 19820 bytes --]

CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: David Awogbemila <awogbemila@google.com>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   85a90500f9a1717c4e142ce92e6c1cb1a339ec78
commit: 2f523dc34ac8c355609e9b847852bf25bbdb30bf gve: NIC stats for report-stats and for ethtool
date:   11 months ago
:::::: branch date: 18 hours ago
:::::: commit date: 11 months ago
config: i386-randconfig-m021-20210807 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
drivers/net/ethernet/google/gve/gve_ethtool.c:331 gve_get_ethtool_stats() warn: we never enter this loop

vim +331 drivers/net/ethernet/google/gve/gve_ethtool.c

e5b845dc79838e Catherine Sullivan 2019-07-01  134  
e5b845dc79838e Catherine Sullivan 2019-07-01  135  static void
e5b845dc79838e Catherine Sullivan 2019-07-01  136  gve_get_ethtool_stats(struct net_device *netdev,
e5b845dc79838e Catherine Sullivan 2019-07-01  137  		      struct ethtool_stats *stats, u64 *data)
e5b845dc79838e Catherine Sullivan 2019-07-01  138  {
433e274b8f7b03 Kuo Zhao           2020-09-11  139  	u64 tmp_rx_pkts, tmp_rx_bytes, tmp_rx_skb_alloc_fail,	tmp_rx_buf_alloc_fail,
433e274b8f7b03 Kuo Zhao           2020-09-11  140  		tmp_rx_desc_err_dropped_pkt, tmp_tx_pkts, tmp_tx_bytes;
433e274b8f7b03 Kuo Zhao           2020-09-11  141  	u64 rx_buf_alloc_fail, rx_desc_err_dropped_pkt, rx_pkts,
433e274b8f7b03 Kuo Zhao           2020-09-11  142  		rx_skb_alloc_fail, rx_bytes, tx_pkts, tx_bytes;
2f523dc34ac8c3 David Awogbemila   2020-09-11  143  	int stats_idx, base_stats_idx, max_stats_idx;
2f523dc34ac8c3 David Awogbemila   2020-09-11  144  	struct stats *report_stats;
2f523dc34ac8c3 David Awogbemila   2020-09-11  145  	int *rx_qid_to_stats_idx;
2f523dc34ac8c3 David Awogbemila   2020-09-11  146  	int *tx_qid_to_stats_idx;
433e274b8f7b03 Kuo Zhao           2020-09-11  147  	struct gve_priv *priv;
2f523dc34ac8c3 David Awogbemila   2020-09-11  148  	bool skip_nic_stats;
e5b845dc79838e Catherine Sullivan 2019-07-01  149  	unsigned int start;
e5b845dc79838e Catherine Sullivan 2019-07-01  150  	int ring;
2f523dc34ac8c3 David Awogbemila   2020-09-11  151  	int i, j;
e5b845dc79838e Catherine Sullivan 2019-07-01  152  
e5b845dc79838e Catherine Sullivan 2019-07-01  153  	ASSERT_RTNL();
e5b845dc79838e Catherine Sullivan 2019-07-01  154  
433e274b8f7b03 Kuo Zhao           2020-09-11  155  	priv = netdev_priv(netdev);
2f523dc34ac8c3 David Awogbemila   2020-09-11  156  	report_stats = priv->stats_report->stats;
2f523dc34ac8c3 David Awogbemila   2020-09-11  157  	rx_qid_to_stats_idx = kmalloc_array(priv->rx_cfg.num_queues,
2f523dc34ac8c3 David Awogbemila   2020-09-11  158  					    sizeof(int), GFP_KERNEL);
2f523dc34ac8c3 David Awogbemila   2020-09-11  159  	if (!rx_qid_to_stats_idx)
2f523dc34ac8c3 David Awogbemila   2020-09-11  160  		return;
2f523dc34ac8c3 David Awogbemila   2020-09-11  161  	tx_qid_to_stats_idx = kmalloc_array(priv->tx_cfg.num_queues,
2f523dc34ac8c3 David Awogbemila   2020-09-11  162  					    sizeof(int), GFP_KERNEL);
2f523dc34ac8c3 David Awogbemila   2020-09-11  163  	if (!tx_qid_to_stats_idx) {
2f523dc34ac8c3 David Awogbemila   2020-09-11  164  		kfree(rx_qid_to_stats_idx);
2f523dc34ac8c3 David Awogbemila   2020-09-11  165  		return;
2f523dc34ac8c3 David Awogbemila   2020-09-11  166  	}
433e274b8f7b03 Kuo Zhao           2020-09-11  167  	for (rx_pkts = 0, rx_bytes = 0, rx_skb_alloc_fail = 0,
433e274b8f7b03 Kuo Zhao           2020-09-11  168  	     rx_buf_alloc_fail = 0, rx_desc_err_dropped_pkt = 0, ring = 0;
e5b845dc79838e Catherine Sullivan 2019-07-01  169  	     ring < priv->rx_cfg.num_queues; ring++) {
e5b845dc79838e Catherine Sullivan 2019-07-01  170  		if (priv->rx) {
e5b845dc79838e Catherine Sullivan 2019-07-01  171  			do {
433e274b8f7b03 Kuo Zhao           2020-09-11  172  				struct gve_rx_ring *rx = &priv->rx[ring];
433e274b8f7b03 Kuo Zhao           2020-09-11  173  
3c13ce74b6f885 Catherine Sullivan 2019-07-02  174  				start =
e5b845dc79838e Catherine Sullivan 2019-07-01  175  				  u64_stats_fetch_begin(&priv->rx[ring].statss);
433e274b8f7b03 Kuo Zhao           2020-09-11  176  				tmp_rx_pkts = rx->rpackets;
433e274b8f7b03 Kuo Zhao           2020-09-11  177  				tmp_rx_bytes = rx->rbytes;
433e274b8f7b03 Kuo Zhao           2020-09-11  178  				tmp_rx_skb_alloc_fail = rx->rx_skb_alloc_fail;
433e274b8f7b03 Kuo Zhao           2020-09-11  179  				tmp_rx_buf_alloc_fail = rx->rx_buf_alloc_fail;
433e274b8f7b03 Kuo Zhao           2020-09-11  180  				tmp_rx_desc_err_dropped_pkt =
433e274b8f7b03 Kuo Zhao           2020-09-11  181  					rx->rx_desc_err_dropped_pkt;
e5b845dc79838e Catherine Sullivan 2019-07-01  182  			} while (u64_stats_fetch_retry(&priv->rx[ring].statss,
e5b845dc79838e Catherine Sullivan 2019-07-01  183  						       start));
433e274b8f7b03 Kuo Zhao           2020-09-11  184  			rx_pkts += tmp_rx_pkts;
433e274b8f7b03 Kuo Zhao           2020-09-11  185  			rx_bytes += tmp_rx_bytes;
433e274b8f7b03 Kuo Zhao           2020-09-11  186  			rx_skb_alloc_fail += tmp_rx_skb_alloc_fail;
433e274b8f7b03 Kuo Zhao           2020-09-11  187  			rx_buf_alloc_fail += tmp_rx_buf_alloc_fail;
433e274b8f7b03 Kuo Zhao           2020-09-11  188  			rx_desc_err_dropped_pkt += tmp_rx_desc_err_dropped_pkt;
e5b845dc79838e Catherine Sullivan 2019-07-01  189  		}
e5b845dc79838e Catherine Sullivan 2019-07-01  190  	}
e5b845dc79838e Catherine Sullivan 2019-07-01  191  	for (tx_pkts = 0, tx_bytes = 0, ring = 0;
e5b845dc79838e Catherine Sullivan 2019-07-01  192  	     ring < priv->tx_cfg.num_queues; ring++) {
e5b845dc79838e Catherine Sullivan 2019-07-01  193  		if (priv->tx) {
e5b845dc79838e Catherine Sullivan 2019-07-01  194  			do {
3c13ce74b6f885 Catherine Sullivan 2019-07-02  195  				start =
e5b845dc79838e Catherine Sullivan 2019-07-01  196  				  u64_stats_fetch_begin(&priv->tx[ring].statss);
433e274b8f7b03 Kuo Zhao           2020-09-11  197  				tmp_tx_pkts = priv->tx[ring].pkt_done;
433e274b8f7b03 Kuo Zhao           2020-09-11  198  				tmp_tx_bytes = priv->tx[ring].bytes_done;
e5b845dc79838e Catherine Sullivan 2019-07-01  199  			} while (u64_stats_fetch_retry(&priv->tx[ring].statss,
e5b845dc79838e Catherine Sullivan 2019-07-01  200  						       start));
433e274b8f7b03 Kuo Zhao           2020-09-11  201  			tx_pkts += tmp_tx_pkts;
433e274b8f7b03 Kuo Zhao           2020-09-11  202  			tx_bytes += tmp_tx_bytes;
e5b845dc79838e Catherine Sullivan 2019-07-01  203  		}
e5b845dc79838e Catherine Sullivan 2019-07-01  204  	}
e5b845dc79838e Catherine Sullivan 2019-07-01  205  
e5b845dc79838e Catherine Sullivan 2019-07-01  206  	i = 0;
e5b845dc79838e Catherine Sullivan 2019-07-01  207  	data[i++] = rx_pkts;
e5b845dc79838e Catherine Sullivan 2019-07-01  208  	data[i++] = tx_pkts;
e5b845dc79838e Catherine Sullivan 2019-07-01  209  	data[i++] = rx_bytes;
e5b845dc79838e Catherine Sullivan 2019-07-01  210  	data[i++] = tx_bytes;
433e274b8f7b03 Kuo Zhao           2020-09-11  211  	/* total rx dropped packets */
433e274b8f7b03 Kuo Zhao           2020-09-11  212  	data[i++] = rx_skb_alloc_fail + rx_buf_alloc_fail +
433e274b8f7b03 Kuo Zhao           2020-09-11  213  		    rx_desc_err_dropped_pkt;
433e274b8f7b03 Kuo Zhao           2020-09-11  214  	/* Skip tx_dropped */
433e274b8f7b03 Kuo Zhao           2020-09-11  215  	i++;
433e274b8f7b03 Kuo Zhao           2020-09-11  216  
e5b845dc79838e Catherine Sullivan 2019-07-01  217  	data[i++] = priv->tx_timeo_cnt;
433e274b8f7b03 Kuo Zhao           2020-09-11  218  	data[i++] = rx_skb_alloc_fail;
433e274b8f7b03 Kuo Zhao           2020-09-11  219  	data[i++] = rx_buf_alloc_fail;
433e274b8f7b03 Kuo Zhao           2020-09-11  220  	data[i++] = rx_desc_err_dropped_pkt;
433e274b8f7b03 Kuo Zhao           2020-09-11  221  	data[i++] = priv->interface_up_cnt;
433e274b8f7b03 Kuo Zhao           2020-09-11  222  	data[i++] = priv->interface_down_cnt;
433e274b8f7b03 Kuo Zhao           2020-09-11  223  	data[i++] = priv->reset_cnt;
433e274b8f7b03 Kuo Zhao           2020-09-11  224  	data[i++] = priv->page_alloc_fail;
433e274b8f7b03 Kuo Zhao           2020-09-11  225  	data[i++] = priv->dma_mapping_error;
24aeb56f2d38ed Kuo Zhao           2020-09-11  226  	data[i++] = priv->stats_report_trigger_cnt;
e5b845dc79838e Catherine Sullivan 2019-07-01  227  	i = GVE_MAIN_STATS_LEN;
e5b845dc79838e Catherine Sullivan 2019-07-01  228  
2f523dc34ac8c3 David Awogbemila   2020-09-11  229  	/* For rx cross-reporting stats, start from nic rx stats in report */
2f523dc34ac8c3 David Awogbemila   2020-09-11  230  	base_stats_idx = GVE_TX_STATS_REPORT_NUM * priv->tx_cfg.num_queues +
2f523dc34ac8c3 David Awogbemila   2020-09-11  231  		GVE_RX_STATS_REPORT_NUM * priv->rx_cfg.num_queues;
2f523dc34ac8c3 David Awogbemila   2020-09-11  232  	max_stats_idx = NIC_RX_STATS_REPORT_NUM * priv->rx_cfg.num_queues +
2f523dc34ac8c3 David Awogbemila   2020-09-11  233  		base_stats_idx;
2f523dc34ac8c3 David Awogbemila   2020-09-11  234  	/* Preprocess the stats report for rx, map queue id to start index */
2f523dc34ac8c3 David Awogbemila   2020-09-11  235  	skip_nic_stats = false;
2f523dc34ac8c3 David Awogbemila   2020-09-11  236  	for (stats_idx = base_stats_idx; stats_idx < max_stats_idx;
2f523dc34ac8c3 David Awogbemila   2020-09-11  237  		stats_idx += NIC_RX_STATS_REPORT_NUM) {
2f523dc34ac8c3 David Awogbemila   2020-09-11  238  		u32 stat_name = be32_to_cpu(report_stats[stats_idx].stat_name);
2f523dc34ac8c3 David Awogbemila   2020-09-11  239  		u32 queue_id = be32_to_cpu(report_stats[stats_idx].queue_id);
2f523dc34ac8c3 David Awogbemila   2020-09-11  240  
2f523dc34ac8c3 David Awogbemila   2020-09-11  241  		if (stat_name == 0) {
2f523dc34ac8c3 David Awogbemila   2020-09-11  242  			/* no stats written by NIC yet */
2f523dc34ac8c3 David Awogbemila   2020-09-11  243  			skip_nic_stats = true;
2f523dc34ac8c3 David Awogbemila   2020-09-11  244  			break;
2f523dc34ac8c3 David Awogbemila   2020-09-11  245  		}
2f523dc34ac8c3 David Awogbemila   2020-09-11  246  		rx_qid_to_stats_idx[queue_id] = stats_idx;
2f523dc34ac8c3 David Awogbemila   2020-09-11  247  	}
e5b845dc79838e Catherine Sullivan 2019-07-01  248  	/* walk RX rings */
e5b845dc79838e Catherine Sullivan 2019-07-01  249  	if (priv->rx) {
e5b845dc79838e Catherine Sullivan 2019-07-01  250  		for (ring = 0; ring < priv->rx_cfg.num_queues; ring++) {
e5b845dc79838e Catherine Sullivan 2019-07-01  251  			struct gve_rx_ring *rx = &priv->rx[ring];
e5b845dc79838e Catherine Sullivan 2019-07-01  252  
438b43bdb95d31 Catherine Sullivan 2019-08-01  253  			data[i++] = rx->fill_cnt;
433e274b8f7b03 Kuo Zhao           2020-09-11  254  			data[i++] = rx->cnt;
433e274b8f7b03 Kuo Zhao           2020-09-11  255  			do {
433e274b8f7b03 Kuo Zhao           2020-09-11  256  				start =
433e274b8f7b03 Kuo Zhao           2020-09-11  257  				  u64_stats_fetch_begin(&priv->rx[ring].statss);
433e274b8f7b03 Kuo Zhao           2020-09-11  258  				tmp_rx_bytes = rx->rbytes;
433e274b8f7b03 Kuo Zhao           2020-09-11  259  				tmp_rx_skb_alloc_fail = rx->rx_skb_alloc_fail;
433e274b8f7b03 Kuo Zhao           2020-09-11  260  				tmp_rx_buf_alloc_fail = rx->rx_buf_alloc_fail;
433e274b8f7b03 Kuo Zhao           2020-09-11  261  				tmp_rx_desc_err_dropped_pkt =
433e274b8f7b03 Kuo Zhao           2020-09-11  262  					rx->rx_desc_err_dropped_pkt;
433e274b8f7b03 Kuo Zhao           2020-09-11  263  			} while (u64_stats_fetch_retry(&priv->rx[ring].statss,
433e274b8f7b03 Kuo Zhao           2020-09-11  264  						       start));
433e274b8f7b03 Kuo Zhao           2020-09-11  265  			data[i++] = tmp_rx_bytes;
433e274b8f7b03 Kuo Zhao           2020-09-11  266  			/* rx dropped packets */
433e274b8f7b03 Kuo Zhao           2020-09-11  267  			data[i++] = tmp_rx_skb_alloc_fail +
433e274b8f7b03 Kuo Zhao           2020-09-11  268  				tmp_rx_buf_alloc_fail +
433e274b8f7b03 Kuo Zhao           2020-09-11  269  				tmp_rx_desc_err_dropped_pkt;
433e274b8f7b03 Kuo Zhao           2020-09-11  270  			data[i++] = rx->rx_copybreak_pkt;
433e274b8f7b03 Kuo Zhao           2020-09-11  271  			data[i++] = rx->rx_copied_pkt;
2f523dc34ac8c3 David Awogbemila   2020-09-11  272  			/* stats from NIC */
2f523dc34ac8c3 David Awogbemila   2020-09-11  273  			if (skip_nic_stats) {
2f523dc34ac8c3 David Awogbemila   2020-09-11  274  				/* skip NIC rx stats */
2f523dc34ac8c3 David Awogbemila   2020-09-11  275  				i += NIC_RX_STATS_REPORT_NUM;
2f523dc34ac8c3 David Awogbemila   2020-09-11  276  				continue;
2f523dc34ac8c3 David Awogbemila   2020-09-11  277  			}
2f523dc34ac8c3 David Awogbemila   2020-09-11  278  			for (j = 0; j < NIC_RX_STATS_REPORT_NUM; j++) {
2f523dc34ac8c3 David Awogbemila   2020-09-11  279  				u64 value =
2f523dc34ac8c3 David Awogbemila   2020-09-11  280  				be64_to_cpu(report_stats[rx_qid_to_stats_idx[ring] + j].value);
2f523dc34ac8c3 David Awogbemila   2020-09-11  281  
2f523dc34ac8c3 David Awogbemila   2020-09-11  282  				data[i++] = value;
2f523dc34ac8c3 David Awogbemila   2020-09-11  283  			}
e5b845dc79838e Catherine Sullivan 2019-07-01  284  		}
e5b845dc79838e Catherine Sullivan 2019-07-01  285  	} else {
e5b845dc79838e Catherine Sullivan 2019-07-01  286  		i += priv->rx_cfg.num_queues * NUM_GVE_RX_CNTS;
e5b845dc79838e Catherine Sullivan 2019-07-01  287  	}
2f523dc34ac8c3 David Awogbemila   2020-09-11  288  
2f523dc34ac8c3 David Awogbemila   2020-09-11  289  	/* For tx cross-reporting stats, start from nic tx stats in report */
2f523dc34ac8c3 David Awogbemila   2020-09-11  290  	base_stats_idx = max_stats_idx;
2f523dc34ac8c3 David Awogbemila   2020-09-11  291  	max_stats_idx = NIC_TX_STATS_REPORT_NUM * priv->tx_cfg.num_queues +
2f523dc34ac8c3 David Awogbemila   2020-09-11  292  		max_stats_idx;
2f523dc34ac8c3 David Awogbemila   2020-09-11  293  	/* Preprocess the stats report for tx, map queue id to start index */
2f523dc34ac8c3 David Awogbemila   2020-09-11  294  	skip_nic_stats = false;
2f523dc34ac8c3 David Awogbemila   2020-09-11  295  	for (stats_idx = base_stats_idx; stats_idx < max_stats_idx;
2f523dc34ac8c3 David Awogbemila   2020-09-11  296  		stats_idx += NIC_TX_STATS_REPORT_NUM) {
2f523dc34ac8c3 David Awogbemila   2020-09-11  297  		u32 stat_name = be32_to_cpu(report_stats[stats_idx].stat_name);
2f523dc34ac8c3 David Awogbemila   2020-09-11  298  		u32 queue_id = be32_to_cpu(report_stats[stats_idx].queue_id);
2f523dc34ac8c3 David Awogbemila   2020-09-11  299  
2f523dc34ac8c3 David Awogbemila   2020-09-11  300  		if (stat_name == 0) {
2f523dc34ac8c3 David Awogbemila   2020-09-11  301  			/* no stats written by NIC yet */
2f523dc34ac8c3 David Awogbemila   2020-09-11  302  			skip_nic_stats = true;
2f523dc34ac8c3 David Awogbemila   2020-09-11  303  			break;
2f523dc34ac8c3 David Awogbemila   2020-09-11  304  		}
2f523dc34ac8c3 David Awogbemila   2020-09-11  305  		tx_qid_to_stats_idx[queue_id] = stats_idx;
2f523dc34ac8c3 David Awogbemila   2020-09-11  306  	}
e5b845dc79838e Catherine Sullivan 2019-07-01  307  	/* walk TX rings */
e5b845dc79838e Catherine Sullivan 2019-07-01  308  	if (priv->tx) {
e5b845dc79838e Catherine Sullivan 2019-07-01  309  		for (ring = 0; ring < priv->tx_cfg.num_queues; ring++) {
e5b845dc79838e Catherine Sullivan 2019-07-01  310  			struct gve_tx_ring *tx = &priv->tx[ring];
e5b845dc79838e Catherine Sullivan 2019-07-01  311  
e5b845dc79838e Catherine Sullivan 2019-07-01  312  			data[i++] = tx->req;
e5b845dc79838e Catherine Sullivan 2019-07-01  313  			data[i++] = tx->done;
433e274b8f7b03 Kuo Zhao           2020-09-11  314  			do {
433e274b8f7b03 Kuo Zhao           2020-09-11  315  				start =
433e274b8f7b03 Kuo Zhao           2020-09-11  316  				  u64_stats_fetch_begin(&priv->tx[ring].statss);
433e274b8f7b03 Kuo Zhao           2020-09-11  317  				tmp_tx_bytes = tx->bytes_done;
433e274b8f7b03 Kuo Zhao           2020-09-11  318  			} while (u64_stats_fetch_retry(&priv->tx[ring].statss,
433e274b8f7b03 Kuo Zhao           2020-09-11  319  						       start));
433e274b8f7b03 Kuo Zhao           2020-09-11  320  			data[i++] = tmp_tx_bytes;
e5b845dc79838e Catherine Sullivan 2019-07-01  321  			data[i++] = tx->wake_queue;
e5b845dc79838e Catherine Sullivan 2019-07-01  322  			data[i++] = tx->stop_queue;
e5b845dc79838e Catherine Sullivan 2019-07-01  323  			data[i++] = be32_to_cpu(gve_tx_load_event_counter(priv,
e5b845dc79838e Catherine Sullivan 2019-07-01  324  									  tx));
2f523dc34ac8c3 David Awogbemila   2020-09-11  325  			/* stats from NIC */
2f523dc34ac8c3 David Awogbemila   2020-09-11  326  			if (skip_nic_stats) {
2f523dc34ac8c3 David Awogbemila   2020-09-11  327  				/* skip NIC tx stats */
2f523dc34ac8c3 David Awogbemila   2020-09-11  328  				i += NIC_TX_STATS_REPORT_NUM;
2f523dc34ac8c3 David Awogbemila   2020-09-11  329  				continue;
2f523dc34ac8c3 David Awogbemila   2020-09-11  330  			}
2f523dc34ac8c3 David Awogbemila   2020-09-11 @331  			for (j = 0; j < NIC_TX_STATS_REPORT_NUM; j++) {
2f523dc34ac8c3 David Awogbemila   2020-09-11  332  				u64 value =
2f523dc34ac8c3 David Awogbemila   2020-09-11  333  				be64_to_cpu(report_stats[tx_qid_to_stats_idx[ring] + j].value);
2f523dc34ac8c3 David Awogbemila   2020-09-11  334  				data[i++] = value;
2f523dc34ac8c3 David Awogbemila   2020-09-11  335  			}
e5b845dc79838e Catherine Sullivan 2019-07-01  336  		}
e5b845dc79838e Catherine Sullivan 2019-07-01  337  	} else {
e5b845dc79838e Catherine Sullivan 2019-07-01  338  		i += priv->tx_cfg.num_queues * NUM_GVE_TX_CNTS;
e5b845dc79838e Catherine Sullivan 2019-07-01  339  	}
2f523dc34ac8c3 David Awogbemila   2020-09-11  340  
2f523dc34ac8c3 David Awogbemila   2020-09-11  341  	kfree(rx_qid_to_stats_idx);
2f523dc34ac8c3 David Awogbemila   2020-09-11  342  	kfree(tx_qid_to_stats_idx);
433e274b8f7b03 Kuo Zhao           2020-09-11  343  	/* AQ Stats */
433e274b8f7b03 Kuo Zhao           2020-09-11  344  	data[i++] = priv->adminq_prod_cnt;
433e274b8f7b03 Kuo Zhao           2020-09-11  345  	data[i++] = priv->adminq_cmd_fail;
433e274b8f7b03 Kuo Zhao           2020-09-11  346  	data[i++] = priv->adminq_timeouts;
433e274b8f7b03 Kuo Zhao           2020-09-11  347  	data[i++] = priv->adminq_describe_device_cnt;
433e274b8f7b03 Kuo Zhao           2020-09-11  348  	data[i++] = priv->adminq_cfg_device_resources_cnt;
433e274b8f7b03 Kuo Zhao           2020-09-11  349  	data[i++] = priv->adminq_register_page_list_cnt;
433e274b8f7b03 Kuo Zhao           2020-09-11  350  	data[i++] = priv->adminq_unregister_page_list_cnt;
433e274b8f7b03 Kuo Zhao           2020-09-11  351  	data[i++] = priv->adminq_create_tx_queue_cnt;
433e274b8f7b03 Kuo Zhao           2020-09-11  352  	data[i++] = priv->adminq_create_rx_queue_cnt;
433e274b8f7b03 Kuo Zhao           2020-09-11  353  	data[i++] = priv->adminq_destroy_tx_queue_cnt;
433e274b8f7b03 Kuo Zhao           2020-09-11  354  	data[i++] = priv->adminq_destroy_rx_queue_cnt;
433e274b8f7b03 Kuo Zhao           2020-09-11  355  	data[i++] = priv->adminq_dcfg_device_resources_cnt;
433e274b8f7b03 Kuo Zhao           2020-09-11  356  	data[i++] = priv->adminq_set_driver_parameter_cnt;
24aeb56f2d38ed Kuo Zhao           2020-09-11  357  	data[i++] = priv->adminq_report_stats_cnt;
e5b845dc79838e Catherine Sullivan 2019-07-01  358  }
e5b845dc79838e Catherine Sullivan 2019-07-01  359  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 36324 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* drivers/net/ethernet/google/gve/gve_ethtool.c:331 gve_get_ethtool_stats() warn: we never enter this loop
@ 2021-01-14  6:39 kernel test robot
  0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2021-01-14  6:39 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 19815 bytes --]

CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: David Awogbemila <awogbemila@google.com>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   65f0d2414b7079556fbbcc070b3d1c9f9587606d
commit: 2f523dc34ac8c355609e9b847852bf25bbdb30bf gve: NIC stats for report-stats and for ethtool
date:   4 months ago
:::::: branch date: 11 hours ago
:::::: commit date: 4 months ago
config: s390-randconfig-m031-20210114 (attached as .config)
compiler: s390-linux-gcc (GCC) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
drivers/net/ethernet/google/gve/gve_ethtool.c:331 gve_get_ethtool_stats() warn: we never enter this loop

vim +331 drivers/net/ethernet/google/gve/gve_ethtool.c

e5b845dc79838e Catherine Sullivan 2019-07-01  134  
e5b845dc79838e Catherine Sullivan 2019-07-01  135  static void
e5b845dc79838e Catherine Sullivan 2019-07-01  136  gve_get_ethtool_stats(struct net_device *netdev,
e5b845dc79838e Catherine Sullivan 2019-07-01  137  		      struct ethtool_stats *stats, u64 *data)
e5b845dc79838e Catherine Sullivan 2019-07-01  138  {
433e274b8f7b03 Kuo Zhao           2020-09-11  139  	u64 tmp_rx_pkts, tmp_rx_bytes, tmp_rx_skb_alloc_fail,	tmp_rx_buf_alloc_fail,
433e274b8f7b03 Kuo Zhao           2020-09-11  140  		tmp_rx_desc_err_dropped_pkt, tmp_tx_pkts, tmp_tx_bytes;
433e274b8f7b03 Kuo Zhao           2020-09-11  141  	u64 rx_buf_alloc_fail, rx_desc_err_dropped_pkt, rx_pkts,
433e274b8f7b03 Kuo Zhao           2020-09-11  142  		rx_skb_alloc_fail, rx_bytes, tx_pkts, tx_bytes;
2f523dc34ac8c3 David Awogbemila   2020-09-11  143  	int stats_idx, base_stats_idx, max_stats_idx;
2f523dc34ac8c3 David Awogbemila   2020-09-11  144  	struct stats *report_stats;
2f523dc34ac8c3 David Awogbemila   2020-09-11  145  	int *rx_qid_to_stats_idx;
2f523dc34ac8c3 David Awogbemila   2020-09-11  146  	int *tx_qid_to_stats_idx;
433e274b8f7b03 Kuo Zhao           2020-09-11  147  	struct gve_priv *priv;
2f523dc34ac8c3 David Awogbemila   2020-09-11  148  	bool skip_nic_stats;
e5b845dc79838e Catherine Sullivan 2019-07-01  149  	unsigned int start;
e5b845dc79838e Catherine Sullivan 2019-07-01  150  	int ring;
2f523dc34ac8c3 David Awogbemila   2020-09-11  151  	int i, j;
e5b845dc79838e Catherine Sullivan 2019-07-01  152  
e5b845dc79838e Catherine Sullivan 2019-07-01  153  	ASSERT_RTNL();
e5b845dc79838e Catherine Sullivan 2019-07-01  154  
433e274b8f7b03 Kuo Zhao           2020-09-11  155  	priv = netdev_priv(netdev);
2f523dc34ac8c3 David Awogbemila   2020-09-11  156  	report_stats = priv->stats_report->stats;
2f523dc34ac8c3 David Awogbemila   2020-09-11  157  	rx_qid_to_stats_idx = kmalloc_array(priv->rx_cfg.num_queues,
2f523dc34ac8c3 David Awogbemila   2020-09-11  158  					    sizeof(int), GFP_KERNEL);
2f523dc34ac8c3 David Awogbemila   2020-09-11  159  	if (!rx_qid_to_stats_idx)
2f523dc34ac8c3 David Awogbemila   2020-09-11  160  		return;
2f523dc34ac8c3 David Awogbemila   2020-09-11  161  	tx_qid_to_stats_idx = kmalloc_array(priv->tx_cfg.num_queues,
2f523dc34ac8c3 David Awogbemila   2020-09-11  162  					    sizeof(int), GFP_KERNEL);
2f523dc34ac8c3 David Awogbemila   2020-09-11  163  	if (!tx_qid_to_stats_idx) {
2f523dc34ac8c3 David Awogbemila   2020-09-11  164  		kfree(rx_qid_to_stats_idx);
2f523dc34ac8c3 David Awogbemila   2020-09-11  165  		return;
2f523dc34ac8c3 David Awogbemila   2020-09-11  166  	}
433e274b8f7b03 Kuo Zhao           2020-09-11  167  	for (rx_pkts = 0, rx_bytes = 0, rx_skb_alloc_fail = 0,
433e274b8f7b03 Kuo Zhao           2020-09-11  168  	     rx_buf_alloc_fail = 0, rx_desc_err_dropped_pkt = 0, ring = 0;
e5b845dc79838e Catherine Sullivan 2019-07-01  169  	     ring < priv->rx_cfg.num_queues; ring++) {
e5b845dc79838e Catherine Sullivan 2019-07-01  170  		if (priv->rx) {
e5b845dc79838e Catherine Sullivan 2019-07-01  171  			do {
433e274b8f7b03 Kuo Zhao           2020-09-11  172  				struct gve_rx_ring *rx = &priv->rx[ring];
433e274b8f7b03 Kuo Zhao           2020-09-11  173  
3c13ce74b6f885 Catherine Sullivan 2019-07-02  174  				start =
e5b845dc79838e Catherine Sullivan 2019-07-01  175  				  u64_stats_fetch_begin(&priv->rx[ring].statss);
433e274b8f7b03 Kuo Zhao           2020-09-11  176  				tmp_rx_pkts = rx->rpackets;
433e274b8f7b03 Kuo Zhao           2020-09-11  177  				tmp_rx_bytes = rx->rbytes;
433e274b8f7b03 Kuo Zhao           2020-09-11  178  				tmp_rx_skb_alloc_fail = rx->rx_skb_alloc_fail;
433e274b8f7b03 Kuo Zhao           2020-09-11  179  				tmp_rx_buf_alloc_fail = rx->rx_buf_alloc_fail;
433e274b8f7b03 Kuo Zhao           2020-09-11  180  				tmp_rx_desc_err_dropped_pkt =
433e274b8f7b03 Kuo Zhao           2020-09-11  181  					rx->rx_desc_err_dropped_pkt;
e5b845dc79838e Catherine Sullivan 2019-07-01  182  			} while (u64_stats_fetch_retry(&priv->rx[ring].statss,
e5b845dc79838e Catherine Sullivan 2019-07-01  183  						       start));
433e274b8f7b03 Kuo Zhao           2020-09-11  184  			rx_pkts += tmp_rx_pkts;
433e274b8f7b03 Kuo Zhao           2020-09-11  185  			rx_bytes += tmp_rx_bytes;
433e274b8f7b03 Kuo Zhao           2020-09-11  186  			rx_skb_alloc_fail += tmp_rx_skb_alloc_fail;
433e274b8f7b03 Kuo Zhao           2020-09-11  187  			rx_buf_alloc_fail += tmp_rx_buf_alloc_fail;
433e274b8f7b03 Kuo Zhao           2020-09-11  188  			rx_desc_err_dropped_pkt += tmp_rx_desc_err_dropped_pkt;
e5b845dc79838e Catherine Sullivan 2019-07-01  189  		}
e5b845dc79838e Catherine Sullivan 2019-07-01  190  	}
e5b845dc79838e Catherine Sullivan 2019-07-01  191  	for (tx_pkts = 0, tx_bytes = 0, ring = 0;
e5b845dc79838e Catherine Sullivan 2019-07-01  192  	     ring < priv->tx_cfg.num_queues; ring++) {
e5b845dc79838e Catherine Sullivan 2019-07-01  193  		if (priv->tx) {
e5b845dc79838e Catherine Sullivan 2019-07-01  194  			do {
3c13ce74b6f885 Catherine Sullivan 2019-07-02  195  				start =
e5b845dc79838e Catherine Sullivan 2019-07-01  196  				  u64_stats_fetch_begin(&priv->tx[ring].statss);
433e274b8f7b03 Kuo Zhao           2020-09-11  197  				tmp_tx_pkts = priv->tx[ring].pkt_done;
433e274b8f7b03 Kuo Zhao           2020-09-11  198  				tmp_tx_bytes = priv->tx[ring].bytes_done;
e5b845dc79838e Catherine Sullivan 2019-07-01  199  			} while (u64_stats_fetch_retry(&priv->tx[ring].statss,
e5b845dc79838e Catherine Sullivan 2019-07-01  200  						       start));
433e274b8f7b03 Kuo Zhao           2020-09-11  201  			tx_pkts += tmp_tx_pkts;
433e274b8f7b03 Kuo Zhao           2020-09-11  202  			tx_bytes += tmp_tx_bytes;
e5b845dc79838e Catherine Sullivan 2019-07-01  203  		}
e5b845dc79838e Catherine Sullivan 2019-07-01  204  	}
e5b845dc79838e Catherine Sullivan 2019-07-01  205  
e5b845dc79838e Catherine Sullivan 2019-07-01  206  	i = 0;
e5b845dc79838e Catherine Sullivan 2019-07-01  207  	data[i++] = rx_pkts;
e5b845dc79838e Catherine Sullivan 2019-07-01  208  	data[i++] = tx_pkts;
e5b845dc79838e Catherine Sullivan 2019-07-01  209  	data[i++] = rx_bytes;
e5b845dc79838e Catherine Sullivan 2019-07-01  210  	data[i++] = tx_bytes;
433e274b8f7b03 Kuo Zhao           2020-09-11  211  	/* total rx dropped packets */
433e274b8f7b03 Kuo Zhao           2020-09-11  212  	data[i++] = rx_skb_alloc_fail + rx_buf_alloc_fail +
433e274b8f7b03 Kuo Zhao           2020-09-11  213  		    rx_desc_err_dropped_pkt;
433e274b8f7b03 Kuo Zhao           2020-09-11  214  	/* Skip tx_dropped */
433e274b8f7b03 Kuo Zhao           2020-09-11  215  	i++;
433e274b8f7b03 Kuo Zhao           2020-09-11  216  
e5b845dc79838e Catherine Sullivan 2019-07-01  217  	data[i++] = priv->tx_timeo_cnt;
433e274b8f7b03 Kuo Zhao           2020-09-11  218  	data[i++] = rx_skb_alloc_fail;
433e274b8f7b03 Kuo Zhao           2020-09-11  219  	data[i++] = rx_buf_alloc_fail;
433e274b8f7b03 Kuo Zhao           2020-09-11  220  	data[i++] = rx_desc_err_dropped_pkt;
433e274b8f7b03 Kuo Zhao           2020-09-11  221  	data[i++] = priv->interface_up_cnt;
433e274b8f7b03 Kuo Zhao           2020-09-11  222  	data[i++] = priv->interface_down_cnt;
433e274b8f7b03 Kuo Zhao           2020-09-11  223  	data[i++] = priv->reset_cnt;
433e274b8f7b03 Kuo Zhao           2020-09-11  224  	data[i++] = priv->page_alloc_fail;
433e274b8f7b03 Kuo Zhao           2020-09-11  225  	data[i++] = priv->dma_mapping_error;
24aeb56f2d38ed Kuo Zhao           2020-09-11  226  	data[i++] = priv->stats_report_trigger_cnt;
e5b845dc79838e Catherine Sullivan 2019-07-01  227  	i = GVE_MAIN_STATS_LEN;
e5b845dc79838e Catherine Sullivan 2019-07-01  228  
2f523dc34ac8c3 David Awogbemila   2020-09-11  229  	/* For rx cross-reporting stats, start from nic rx stats in report */
2f523dc34ac8c3 David Awogbemila   2020-09-11  230  	base_stats_idx = GVE_TX_STATS_REPORT_NUM * priv->tx_cfg.num_queues +
2f523dc34ac8c3 David Awogbemila   2020-09-11  231  		GVE_RX_STATS_REPORT_NUM * priv->rx_cfg.num_queues;
2f523dc34ac8c3 David Awogbemila   2020-09-11  232  	max_stats_idx = NIC_RX_STATS_REPORT_NUM * priv->rx_cfg.num_queues +
2f523dc34ac8c3 David Awogbemila   2020-09-11  233  		base_stats_idx;
2f523dc34ac8c3 David Awogbemila   2020-09-11  234  	/* Preprocess the stats report for rx, map queue id to start index */
2f523dc34ac8c3 David Awogbemila   2020-09-11  235  	skip_nic_stats = false;
2f523dc34ac8c3 David Awogbemila   2020-09-11  236  	for (stats_idx = base_stats_idx; stats_idx < max_stats_idx;
2f523dc34ac8c3 David Awogbemila   2020-09-11  237  		stats_idx += NIC_RX_STATS_REPORT_NUM) {
2f523dc34ac8c3 David Awogbemila   2020-09-11  238  		u32 stat_name = be32_to_cpu(report_stats[stats_idx].stat_name);
2f523dc34ac8c3 David Awogbemila   2020-09-11  239  		u32 queue_id = be32_to_cpu(report_stats[stats_idx].queue_id);
2f523dc34ac8c3 David Awogbemila   2020-09-11  240  
2f523dc34ac8c3 David Awogbemila   2020-09-11  241  		if (stat_name == 0) {
2f523dc34ac8c3 David Awogbemila   2020-09-11  242  			/* no stats written by NIC yet */
2f523dc34ac8c3 David Awogbemila   2020-09-11  243  			skip_nic_stats = true;
2f523dc34ac8c3 David Awogbemila   2020-09-11  244  			break;
2f523dc34ac8c3 David Awogbemila   2020-09-11  245  		}
2f523dc34ac8c3 David Awogbemila   2020-09-11  246  		rx_qid_to_stats_idx[queue_id] = stats_idx;
2f523dc34ac8c3 David Awogbemila   2020-09-11  247  	}
e5b845dc79838e Catherine Sullivan 2019-07-01  248  	/* walk RX rings */
e5b845dc79838e Catherine Sullivan 2019-07-01  249  	if (priv->rx) {
e5b845dc79838e Catherine Sullivan 2019-07-01  250  		for (ring = 0; ring < priv->rx_cfg.num_queues; ring++) {
e5b845dc79838e Catherine Sullivan 2019-07-01  251  			struct gve_rx_ring *rx = &priv->rx[ring];
e5b845dc79838e Catherine Sullivan 2019-07-01  252  
438b43bdb95d31 Catherine Sullivan 2019-08-01  253  			data[i++] = rx->fill_cnt;
433e274b8f7b03 Kuo Zhao           2020-09-11  254  			data[i++] = rx->cnt;
433e274b8f7b03 Kuo Zhao           2020-09-11  255  			do {
433e274b8f7b03 Kuo Zhao           2020-09-11  256  				start =
433e274b8f7b03 Kuo Zhao           2020-09-11  257  				  u64_stats_fetch_begin(&priv->rx[ring].statss);
433e274b8f7b03 Kuo Zhao           2020-09-11  258  				tmp_rx_bytes = rx->rbytes;
433e274b8f7b03 Kuo Zhao           2020-09-11  259  				tmp_rx_skb_alloc_fail = rx->rx_skb_alloc_fail;
433e274b8f7b03 Kuo Zhao           2020-09-11  260  				tmp_rx_buf_alloc_fail = rx->rx_buf_alloc_fail;
433e274b8f7b03 Kuo Zhao           2020-09-11  261  				tmp_rx_desc_err_dropped_pkt =
433e274b8f7b03 Kuo Zhao           2020-09-11  262  					rx->rx_desc_err_dropped_pkt;
433e274b8f7b03 Kuo Zhao           2020-09-11  263  			} while (u64_stats_fetch_retry(&priv->rx[ring].statss,
433e274b8f7b03 Kuo Zhao           2020-09-11  264  						       start));
433e274b8f7b03 Kuo Zhao           2020-09-11  265  			data[i++] = tmp_rx_bytes;
433e274b8f7b03 Kuo Zhao           2020-09-11  266  			/* rx dropped packets */
433e274b8f7b03 Kuo Zhao           2020-09-11  267  			data[i++] = tmp_rx_skb_alloc_fail +
433e274b8f7b03 Kuo Zhao           2020-09-11  268  				tmp_rx_buf_alloc_fail +
433e274b8f7b03 Kuo Zhao           2020-09-11  269  				tmp_rx_desc_err_dropped_pkt;
433e274b8f7b03 Kuo Zhao           2020-09-11  270  			data[i++] = rx->rx_copybreak_pkt;
433e274b8f7b03 Kuo Zhao           2020-09-11  271  			data[i++] = rx->rx_copied_pkt;
2f523dc34ac8c3 David Awogbemila   2020-09-11  272  			/* stats from NIC */
2f523dc34ac8c3 David Awogbemila   2020-09-11  273  			if (skip_nic_stats) {
2f523dc34ac8c3 David Awogbemila   2020-09-11  274  				/* skip NIC rx stats */
2f523dc34ac8c3 David Awogbemila   2020-09-11  275  				i += NIC_RX_STATS_REPORT_NUM;
2f523dc34ac8c3 David Awogbemila   2020-09-11  276  				continue;
2f523dc34ac8c3 David Awogbemila   2020-09-11  277  			}
2f523dc34ac8c3 David Awogbemila   2020-09-11  278  			for (j = 0; j < NIC_RX_STATS_REPORT_NUM; j++) {
2f523dc34ac8c3 David Awogbemila   2020-09-11  279  				u64 value =
2f523dc34ac8c3 David Awogbemila   2020-09-11  280  				be64_to_cpu(report_stats[rx_qid_to_stats_idx[ring] + j].value);
2f523dc34ac8c3 David Awogbemila   2020-09-11  281  
2f523dc34ac8c3 David Awogbemila   2020-09-11  282  				data[i++] = value;
2f523dc34ac8c3 David Awogbemila   2020-09-11  283  			}
e5b845dc79838e Catherine Sullivan 2019-07-01  284  		}
e5b845dc79838e Catherine Sullivan 2019-07-01  285  	} else {
e5b845dc79838e Catherine Sullivan 2019-07-01  286  		i += priv->rx_cfg.num_queues * NUM_GVE_RX_CNTS;
e5b845dc79838e Catherine Sullivan 2019-07-01  287  	}
2f523dc34ac8c3 David Awogbemila   2020-09-11  288  
2f523dc34ac8c3 David Awogbemila   2020-09-11  289  	/* For tx cross-reporting stats, start from nic tx stats in report */
2f523dc34ac8c3 David Awogbemila   2020-09-11  290  	base_stats_idx = max_stats_idx;
2f523dc34ac8c3 David Awogbemila   2020-09-11  291  	max_stats_idx = NIC_TX_STATS_REPORT_NUM * priv->tx_cfg.num_queues +
2f523dc34ac8c3 David Awogbemila   2020-09-11  292  		max_stats_idx;
2f523dc34ac8c3 David Awogbemila   2020-09-11  293  	/* Preprocess the stats report for tx, map queue id to start index */
2f523dc34ac8c3 David Awogbemila   2020-09-11  294  	skip_nic_stats = false;
2f523dc34ac8c3 David Awogbemila   2020-09-11  295  	for (stats_idx = base_stats_idx; stats_idx < max_stats_idx;
2f523dc34ac8c3 David Awogbemila   2020-09-11  296  		stats_idx += NIC_TX_STATS_REPORT_NUM) {
2f523dc34ac8c3 David Awogbemila   2020-09-11  297  		u32 stat_name = be32_to_cpu(report_stats[stats_idx].stat_name);
2f523dc34ac8c3 David Awogbemila   2020-09-11  298  		u32 queue_id = be32_to_cpu(report_stats[stats_idx].queue_id);
2f523dc34ac8c3 David Awogbemila   2020-09-11  299  
2f523dc34ac8c3 David Awogbemila   2020-09-11  300  		if (stat_name == 0) {
2f523dc34ac8c3 David Awogbemila   2020-09-11  301  			/* no stats written by NIC yet */
2f523dc34ac8c3 David Awogbemila   2020-09-11  302  			skip_nic_stats = true;
2f523dc34ac8c3 David Awogbemila   2020-09-11  303  			break;
2f523dc34ac8c3 David Awogbemila   2020-09-11  304  		}
2f523dc34ac8c3 David Awogbemila   2020-09-11  305  		tx_qid_to_stats_idx[queue_id] = stats_idx;
2f523dc34ac8c3 David Awogbemila   2020-09-11  306  	}
e5b845dc79838e Catherine Sullivan 2019-07-01  307  	/* walk TX rings */
e5b845dc79838e Catherine Sullivan 2019-07-01  308  	if (priv->tx) {
e5b845dc79838e Catherine Sullivan 2019-07-01  309  		for (ring = 0; ring < priv->tx_cfg.num_queues; ring++) {
e5b845dc79838e Catherine Sullivan 2019-07-01  310  			struct gve_tx_ring *tx = &priv->tx[ring];
e5b845dc79838e Catherine Sullivan 2019-07-01  311  
e5b845dc79838e Catherine Sullivan 2019-07-01  312  			data[i++] = tx->req;
e5b845dc79838e Catherine Sullivan 2019-07-01  313  			data[i++] = tx->done;
433e274b8f7b03 Kuo Zhao           2020-09-11  314  			do {
433e274b8f7b03 Kuo Zhao           2020-09-11  315  				start =
433e274b8f7b03 Kuo Zhao           2020-09-11  316  				  u64_stats_fetch_begin(&priv->tx[ring].statss);
433e274b8f7b03 Kuo Zhao           2020-09-11  317  				tmp_tx_bytes = tx->bytes_done;
433e274b8f7b03 Kuo Zhao           2020-09-11  318  			} while (u64_stats_fetch_retry(&priv->tx[ring].statss,
433e274b8f7b03 Kuo Zhao           2020-09-11  319  						       start));
433e274b8f7b03 Kuo Zhao           2020-09-11  320  			data[i++] = tmp_tx_bytes;
e5b845dc79838e Catherine Sullivan 2019-07-01  321  			data[i++] = tx->wake_queue;
e5b845dc79838e Catherine Sullivan 2019-07-01  322  			data[i++] = tx->stop_queue;
e5b845dc79838e Catherine Sullivan 2019-07-01  323  			data[i++] = be32_to_cpu(gve_tx_load_event_counter(priv,
e5b845dc79838e Catherine Sullivan 2019-07-01  324  									  tx));
2f523dc34ac8c3 David Awogbemila   2020-09-11  325  			/* stats from NIC */
2f523dc34ac8c3 David Awogbemila   2020-09-11  326  			if (skip_nic_stats) {
2f523dc34ac8c3 David Awogbemila   2020-09-11  327  				/* skip NIC tx stats */
2f523dc34ac8c3 David Awogbemila   2020-09-11  328  				i += NIC_TX_STATS_REPORT_NUM;
2f523dc34ac8c3 David Awogbemila   2020-09-11  329  				continue;
2f523dc34ac8c3 David Awogbemila   2020-09-11  330  			}
2f523dc34ac8c3 David Awogbemila   2020-09-11 @331  			for (j = 0; j < NIC_TX_STATS_REPORT_NUM; j++) {
2f523dc34ac8c3 David Awogbemila   2020-09-11  332  				u64 value =
2f523dc34ac8c3 David Awogbemila   2020-09-11  333  				be64_to_cpu(report_stats[tx_qid_to_stats_idx[ring] + j].value);
2f523dc34ac8c3 David Awogbemila   2020-09-11  334  				data[i++] = value;
2f523dc34ac8c3 David Awogbemila   2020-09-11  335  			}
e5b845dc79838e Catherine Sullivan 2019-07-01  336  		}
e5b845dc79838e Catherine Sullivan 2019-07-01  337  	} else {
e5b845dc79838e Catherine Sullivan 2019-07-01  338  		i += priv->tx_cfg.num_queues * NUM_GVE_TX_CNTS;
e5b845dc79838e Catherine Sullivan 2019-07-01  339  	}
2f523dc34ac8c3 David Awogbemila   2020-09-11  340  
2f523dc34ac8c3 David Awogbemila   2020-09-11  341  	kfree(rx_qid_to_stats_idx);
2f523dc34ac8c3 David Awogbemila   2020-09-11  342  	kfree(tx_qid_to_stats_idx);
433e274b8f7b03 Kuo Zhao           2020-09-11  343  	/* AQ Stats */
433e274b8f7b03 Kuo Zhao           2020-09-11  344  	data[i++] = priv->adminq_prod_cnt;
433e274b8f7b03 Kuo Zhao           2020-09-11  345  	data[i++] = priv->adminq_cmd_fail;
433e274b8f7b03 Kuo Zhao           2020-09-11  346  	data[i++] = priv->adminq_timeouts;
433e274b8f7b03 Kuo Zhao           2020-09-11  347  	data[i++] = priv->adminq_describe_device_cnt;
433e274b8f7b03 Kuo Zhao           2020-09-11  348  	data[i++] = priv->adminq_cfg_device_resources_cnt;
433e274b8f7b03 Kuo Zhao           2020-09-11  349  	data[i++] = priv->adminq_register_page_list_cnt;
433e274b8f7b03 Kuo Zhao           2020-09-11  350  	data[i++] = priv->adminq_unregister_page_list_cnt;
433e274b8f7b03 Kuo Zhao           2020-09-11  351  	data[i++] = priv->adminq_create_tx_queue_cnt;
433e274b8f7b03 Kuo Zhao           2020-09-11  352  	data[i++] = priv->adminq_create_rx_queue_cnt;
433e274b8f7b03 Kuo Zhao           2020-09-11  353  	data[i++] = priv->adminq_destroy_tx_queue_cnt;
433e274b8f7b03 Kuo Zhao           2020-09-11  354  	data[i++] = priv->adminq_destroy_rx_queue_cnt;
433e274b8f7b03 Kuo Zhao           2020-09-11  355  	data[i++] = priv->adminq_dcfg_device_resources_cnt;
433e274b8f7b03 Kuo Zhao           2020-09-11  356  	data[i++] = priv->adminq_set_driver_parameter_cnt;
24aeb56f2d38ed Kuo Zhao           2020-09-11  357  	data[i++] = priv->adminq_report_stats_cnt;
e5b845dc79838e Catherine Sullivan 2019-07-01  358  }
e5b845dc79838e Catherine Sullivan 2019-07-01  359  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 22831 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-08-08 11:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-23 11:19 drivers/net/ethernet/google/gve/gve_ethtool.c:331 gve_get_ethtool_stats() warn: we never enter this loop kernel test robot
  -- strict thread matches above, loose matches on Subject: below --
2021-08-08 11:34 kernel test robot
2021-01-14  6:39 kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.