Commit 68db9ec2 authored by Sudarsana Reddy Kalluru's avatar Sudarsana Reddy Kalluru Committed by David S. Miller

qede: Add support for per-queue stats.

Signed-off-by: default avatarSudarsana Reddy Kalluru <sudarsana.kalluru@qlogic.com>
Signed-off-by: default avatarYuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 1a5a366f
...@@ -237,6 +237,7 @@ struct qede_rx_queue { ...@@ -237,6 +237,7 @@ struct qede_rx_queue {
u16 num_rx_buffers; u16 num_rx_buffers;
u16 rxq_id; u16 rxq_id;
u64 rcv_pkts;
u64 rx_hw_errors; u64 rx_hw_errors;
u64 rx_alloc_errors; u64 rx_alloc_errors;
u64 rx_ip_frags; u64 rx_ip_frags;
...@@ -265,6 +266,8 @@ struct qede_tx_queue { ...@@ -265,6 +266,8 @@ struct qede_tx_queue {
union db_prod tx_db; union db_prod tx_db;
u16 num_tx_buffers; u16 num_tx_buffers;
u64 xmit_pkts;
u64 stopped_cnt;
}; };
#define BD_UNMAP_ADDR(bd) HILO_U64(le32_to_cpu((bd)->addr.hi), \ #define BD_UNMAP_ADDR(bd) HILO_U64(le32_to_cpu((bd)->addr.hi), \
......
...@@ -35,6 +35,7 @@ static const struct { ...@@ -35,6 +35,7 @@ static const struct {
u64 offset; u64 offset;
char string[ETH_GSTRING_LEN]; char string[ETH_GSTRING_LEN];
} qede_rqstats_arr[] = { } qede_rqstats_arr[] = {
QEDE_RQSTAT(rcv_pkts),
QEDE_RQSTAT(rx_hw_errors), QEDE_RQSTAT(rx_hw_errors),
QEDE_RQSTAT(rx_alloc_errors), QEDE_RQSTAT(rx_alloc_errors),
QEDE_RQSTAT(rx_ip_frags), QEDE_RQSTAT(rx_ip_frags),
...@@ -44,6 +45,24 @@ static const struct { ...@@ -44,6 +45,24 @@ static const struct {
#define QEDE_RQSTATS_DATA(dev, sindex, rqindex) \ #define QEDE_RQSTATS_DATA(dev, sindex, rqindex) \
(*((u64 *)(((char *)(dev->fp_array[(rqindex)].rxq)) +\ (*((u64 *)(((char *)(dev->fp_array[(rqindex)].rxq)) +\
qede_rqstats_arr[(sindex)].offset))) qede_rqstats_arr[(sindex)].offset)))
#define QEDE_TQSTAT_OFFSET(stat_name) \
(offsetof(struct qede_tx_queue, stat_name))
#define QEDE_TQSTAT_STRING(stat_name) (#stat_name)
#define QEDE_TQSTAT(stat_name) \
{QEDE_TQSTAT_OFFSET(stat_name), QEDE_TQSTAT_STRING(stat_name)}
#define QEDE_NUM_TQSTATS ARRAY_SIZE(qede_tqstats_arr)
static const struct {
u64 offset;
char string[ETH_GSTRING_LEN];
} qede_tqstats_arr[] = {
QEDE_TQSTAT(xmit_pkts),
QEDE_TQSTAT(stopped_cnt),
};
#define QEDE_TQSTATS_DATA(dev, sindex, tssid, tcid) \
(*((u64 *)(((u64)(&dev->fp_array[tssid].txqs[tcid])) +\
qede_tqstats_arr[(sindex)].offset)))
static const struct { static const struct {
u64 offset; u64 offset;
char string[ETH_GSTRING_LEN]; char string[ETH_GSTRING_LEN];
...@@ -153,17 +172,29 @@ static void qede_get_strings_stats(struct qede_dev *edev, u8 *buf) ...@@ -153,17 +172,29 @@ static void qede_get_strings_stats(struct qede_dev *edev, u8 *buf)
{ {
int i, j, k; int i, j, k;
for (i = 0, k = 0; i < edev->num_rss; i++) {
int tc;
for (j = 0; j < QEDE_NUM_RQSTATS; j++)
sprintf(buf + (k + j) * ETH_GSTRING_LEN,
"%d: %s", i, qede_rqstats_arr[j].string);
k += QEDE_NUM_RQSTATS;
for (tc = 0; tc < edev->num_tc; tc++) {
for (j = 0; j < QEDE_NUM_TQSTATS; j++)
sprintf(buf + (k + j) * ETH_GSTRING_LEN,
"%d.%d: %s", i, tc,
qede_tqstats_arr[j].string);
k += QEDE_NUM_TQSTATS;
}
}
for (i = 0, j = 0; i < QEDE_NUM_STATS; i++) { for (i = 0, j = 0; i < QEDE_NUM_STATS; i++) {
if (IS_VF(edev) && qede_stats_arr[i].pf_only) if (IS_VF(edev) && qede_stats_arr[i].pf_only)
continue; continue;
strcpy(buf + j * ETH_GSTRING_LEN, strcpy(buf + (k + j) * ETH_GSTRING_LEN,
qede_stats_arr[i].string); qede_stats_arr[i].string);
j++; j++;
} }
for (k = 0; k < QEDE_NUM_RQSTATS; k++, j++)
strcpy(buf + j * ETH_GSTRING_LEN,
qede_rqstats_arr[k].string);
} }
static void qede_get_strings(struct net_device *dev, u32 stringset, u8 *buf) static void qede_get_strings(struct net_device *dev, u32 stringset, u8 *buf)
...@@ -199,19 +230,24 @@ static void qede_get_ethtool_stats(struct net_device *dev, ...@@ -199,19 +230,24 @@ static void qede_get_ethtool_stats(struct net_device *dev,
mutex_lock(&edev->qede_lock); mutex_lock(&edev->qede_lock);
for (qid = 0; qid < edev->num_rss; qid++) {
int tc;
for (sidx = 0; sidx < QEDE_NUM_RQSTATS; sidx++)
buf[cnt++] = QEDE_RQSTATS_DATA(edev, sidx, qid);
for (tc = 0; tc < edev->num_tc; tc++) {
for (sidx = 0; sidx < QEDE_NUM_TQSTATS; sidx++)
buf[cnt++] = QEDE_TQSTATS_DATA(edev, sidx, qid,
tc);
}
}
for (sidx = 0; sidx < QEDE_NUM_STATS; sidx++) { for (sidx = 0; sidx < QEDE_NUM_STATS; sidx++) {
if (IS_VF(edev) && qede_stats_arr[sidx].pf_only) if (IS_VF(edev) && qede_stats_arr[sidx].pf_only)
continue; continue;
buf[cnt++] = QEDE_STATS_DATA(edev, sidx); buf[cnt++] = QEDE_STATS_DATA(edev, sidx);
} }
for (sidx = 0; sidx < QEDE_NUM_RQSTATS; sidx++) {
buf[cnt] = 0;
for (qid = 0; qid < edev->num_rss; qid++)
buf[cnt] += QEDE_RQSTATS_DATA(edev, sidx, qid);
cnt++;
}
mutex_unlock(&edev->qede_lock); mutex_unlock(&edev->qede_lock);
} }
...@@ -229,7 +265,8 @@ static int qede_get_sset_count(struct net_device *dev, int stringset) ...@@ -229,7 +265,8 @@ static int qede_get_sset_count(struct net_device *dev, int stringset)
if (qede_stats_arr[i].pf_only) if (qede_stats_arr[i].pf_only)
num_stats--; num_stats--;
} }
return num_stats + QEDE_NUM_RQSTATS; return num_stats + edev->num_rss *
(QEDE_NUM_RQSTATS + QEDE_NUM_TQSTATS * edev->num_tc);
case ETH_SS_PRIV_FLAGS: case ETH_SS_PRIV_FLAGS:
return QEDE_PRI_FLAG_LEN; return QEDE_PRI_FLAG_LEN;
case ETH_SS_TEST: case ETH_SS_TEST:
......
...@@ -720,6 +720,7 @@ static netdev_tx_t qede_start_xmit(struct sk_buff *skb, ...@@ -720,6 +720,7 @@ static netdev_tx_t qede_start_xmit(struct sk_buff *skb,
if (unlikely(qed_chain_get_elem_left(&txq->tx_pbl) if (unlikely(qed_chain_get_elem_left(&txq->tx_pbl)
< (MAX_SKB_FRAGS + 1))) { < (MAX_SKB_FRAGS + 1))) {
netif_tx_stop_queue(netdev_txq); netif_tx_stop_queue(netdev_txq);
txq->stopped_cnt++;
DP_VERBOSE(edev, NETIF_MSG_TX_QUEUED, DP_VERBOSE(edev, NETIF_MSG_TX_QUEUED,
"Stop queue was called\n"); "Stop queue was called\n");
/* paired memory barrier is in qede_tx_int(), we have to keep /* paired memory barrier is in qede_tx_int(), we have to keep
...@@ -779,6 +780,7 @@ static int qede_tx_int(struct qede_dev *edev, struct qede_tx_queue *txq) ...@@ -779,6 +780,7 @@ static int qede_tx_int(struct qede_dev *edev, struct qede_tx_queue *txq)
bytes_compl += len; bytes_compl += len;
pkts_compl++; pkts_compl++;
txq->sw_tx_cons++; txq->sw_tx_cons++;
txq->xmit_pkts++;
} }
netdev_tx_completed_queue(netdev_txq, pkts_compl, bytes_compl); netdev_tx_completed_queue(netdev_txq, pkts_compl, bytes_compl);
...@@ -1587,6 +1589,8 @@ static int qede_rx_int(struct qede_fastpath *fp, int budget) ...@@ -1587,6 +1589,8 @@ static int qede_rx_int(struct qede_fastpath *fp, int budget)
/* Update producers */ /* Update producers */
qede_update_rx_prod(edev, rxq); qede_update_rx_prod(edev, rxq);
rxq->rcv_pkts += rx_pkt;
return rx_pkt; return rx_pkt;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment