Commit 1f164717 authored by Raghu Vatsavayi's avatar Raghu Vatsavayi Committed by David S. Miller

liquidio: New statistics support

This patch adds extensive support of statistics for data path,
control path and firmware.
Signed-off-by: default avatarDerek Chickles <derek.chickles@caviumnetworks.com>
Signed-off-by: default avatarSatanand Burla <satananda.burla@caviumnetworks.com>
Signed-off-by: default avatarFelix Manlunas <felix.manlunas@caviumnetworks.com>
Signed-off-by: default avatarRaghu Vatsavayi <raghu.vatsavayi@caviumnetworks.com>
Signed-off-by: default avatarRaghu Vatsavayi <rvatsavayi@caviumnetworks.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 78e6a9b4
...@@ -72,6 +72,9 @@ MODULE_PARM_DESC(console_bitmask, ...@@ -72,6 +72,9 @@ MODULE_PARM_DESC(console_bitmask,
#define DEFAULT_MSG_ENABLE (NETIF_MSG_DRV | NETIF_MSG_PROBE | NETIF_MSG_LINK) #define DEFAULT_MSG_ENABLE (NETIF_MSG_DRV | NETIF_MSG_PROBE | NETIF_MSG_LINK)
#define INCR_INSTRQUEUE_PKT_COUNT(octeon_dev_ptr, iq_no, field, count) \
(octeon_dev_ptr->instr_queue[iq_no]->stats.field += count)
static int debug = -1; static int debug = -1;
module_param(debug, int, 0644); module_param(debug, int, 0644);
MODULE_PARM_DESC(debug, "NETIF_MSG debug bits"); MODULE_PARM_DESC(debug, "NETIF_MSG debug bits");
...@@ -682,13 +685,24 @@ static inline void txqs_start(struct net_device *netdev) ...@@ -682,13 +685,24 @@ static inline void txqs_start(struct net_device *netdev)
*/ */
static inline void txqs_wake(struct net_device *netdev) static inline void txqs_wake(struct net_device *netdev)
{ {
struct lio *lio = GET_LIO(netdev);
if (netif_is_multiqueue(netdev)) { if (netif_is_multiqueue(netdev)) {
int i; int i;
for (i = 0; i < netdev->num_tx_queues; i++) for (i = 0; i < netdev->num_tx_queues; i++) {
if (__netif_subqueue_stopped(netdev, i)) int qno = lio->linfo.txpciq[i %
(lio->linfo.num_txpciq)].s.q_no;
if (__netif_subqueue_stopped(netdev, i)) {
INCR_INSTRQUEUE_PKT_COUNT(lio->oct_dev, qno,
tx_restart, 1);
netif_wake_subqueue(netdev, i); netif_wake_subqueue(netdev, i);
}
}
} else { } else {
INCR_INSTRQUEUE_PKT_COUNT(lio->oct_dev, lio->txq,
tx_restart, 1);
netif_wake_queue(netdev); netif_wake_queue(netdev);
} }
} }
...@@ -763,6 +777,8 @@ static inline int check_txq_status(struct lio *lio) ...@@ -763,6 +777,8 @@ static inline int check_txq_status(struct lio *lio)
continue; continue;
if (__netif_subqueue_stopped(lio->netdev, q)) { if (__netif_subqueue_stopped(lio->netdev, q)) {
wake_q(lio->netdev, q); wake_q(lio->netdev, q);
INCR_INSTRQUEUE_PKT_COUNT(lio->oct_dev, iq,
tx_restart, 1);
ret_val++; ret_val++;
} }
} }
...@@ -770,6 +786,8 @@ static inline int check_txq_status(struct lio *lio) ...@@ -770,6 +786,8 @@ static inline int check_txq_status(struct lio *lio)
if (octnet_iq_is_full(lio->oct_dev, lio->txq)) if (octnet_iq_is_full(lio->oct_dev, lio->txq))
return 0; return 0;
wake_q(lio->netdev, lio->txq); wake_q(lio->netdev, lio->txq);
INCR_INSTRQUEUE_PKT_COUNT(lio->oct_dev, lio->txq,
tx_restart, 1);
ret_val = 1; ret_val = 1;
} }
return ret_val; return ret_val;
...@@ -981,10 +999,16 @@ static void update_txq_status(struct octeon_device *oct, int iq_num) ...@@ -981,10 +999,16 @@ static void update_txq_status(struct octeon_device *oct, int iq_num)
if (__netif_subqueue_stopped(netdev, iq->q_index) && if (__netif_subqueue_stopped(netdev, iq->q_index) &&
lio->linfo.link.s.link_up && lio->linfo.link.s.link_up &&
(!octnet_iq_is_full(oct, iq_num))) { (!octnet_iq_is_full(oct, iq_num))) {
INCR_INSTRQUEUE_PKT_COUNT(lio->oct_dev, iq_num,
tx_restart, 1);
netif_wake_subqueue(netdev, iq->q_index); netif_wake_subqueue(netdev, iq->q_index);
} else { } else {
if (!octnet_iq_is_full(oct, lio->txq)) if (!octnet_iq_is_full(oct, lio->txq)) {
INCR_INSTRQUEUE_PKT_COUNT(lio->oct_dev,
lio->txq,
tx_restart, 1);
wake_q(netdev, lio->txq); wake_q(netdev, lio->txq);
}
} }
} }
} }
...@@ -1115,6 +1139,9 @@ static int liquidio_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -1115,6 +1139,9 @@ static int liquidio_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
return -ENOMEM; return -ENOMEM;
} }
oct_dev->rx_pause = 1;
oct_dev->tx_pause = 1;
dev_dbg(&oct_dev->pci_dev->dev, "Device is ready\n"); dev_dbg(&oct_dev->pci_dev->dev, "Device is ready\n");
return 0; return 0;
...@@ -1468,8 +1495,10 @@ static inline int check_txq_state(struct lio *lio, struct sk_buff *skb) ...@@ -1468,8 +1495,10 @@ static inline int check_txq_state(struct lio *lio, struct sk_buff *skb)
if (octnet_iq_is_full(lio->oct_dev, iq)) if (octnet_iq_is_full(lio->oct_dev, iq))
return 0; return 0;
if (__netif_subqueue_stopped(lio->netdev, q)) if (__netif_subqueue_stopped(lio->netdev, q)) {
INCR_INSTRQUEUE_PKT_COUNT(lio->oct_dev, iq, tx_restart, 1);
wake_q(lio->netdev, q); wake_q(lio->netdev, q);
}
return 1; return 1;
} }
...@@ -2382,6 +2411,10 @@ void liquidio_link_ctrl_cmd_completion(void *nctrl_ptr) ...@@ -2382,6 +2411,10 @@ void liquidio_link_ctrl_cmd_completion(void *nctrl_ptr)
break; break;
case OCTNET_CMD_SET_FLOW_CTL:
netif_info(lio, probe, lio->netdev, "Set RX/TX flow control parameters\n");
break;
default: default:
dev_err(&oct->pci_dev->dev, "%s Unknown cmd %d\n", __func__, dev_err(&oct->pci_dev->dev, "%s Unknown cmd %d\n", __func__,
nctrl->ncmd.s.cmd); nctrl->ncmd.s.cmd);
...@@ -2976,7 +3009,9 @@ static int liquidio_xmit(struct sk_buff *skb, struct net_device *netdev) ...@@ -2976,7 +3009,9 @@ static int liquidio_xmit(struct sk_buff *skb, struct net_device *netdev)
if (skb_shinfo(skb)->gso_size) { if (skb_shinfo(skb)->gso_size) {
tx_info->s.gso_size = skb_shinfo(skb)->gso_size; tx_info->s.gso_size = skb_shinfo(skb)->gso_size;
tx_info->s.gso_segs = skb_shinfo(skb)->gso_segs; tx_info->s.gso_segs = skb_shinfo(skb)->gso_segs;
stats->tx_gso++;
} }
/* HW insert VLAN tag */ /* HW insert VLAN tag */
if (skb_vlan_tag_present(skb)) { if (skb_vlan_tag_present(skb)) {
irh->priority = skb_vlan_tag_get(skb) >> 13; irh->priority = skb_vlan_tag_get(skb) >> 13;
...@@ -2999,7 +3034,10 @@ static int liquidio_xmit(struct sk_buff *skb, struct net_device *netdev) ...@@ -2999,7 +3034,10 @@ static int liquidio_xmit(struct sk_buff *skb, struct net_device *netdev)
netif_trans_update(netdev); netif_trans_update(netdev);
stats->tx_done++; if (skb_shinfo(skb)->gso_size)
stats->tx_done += skb_shinfo(skb)->gso_segs;
else
stats->tx_done++;
stats->tx_tot_bytes += skb->len; stats->tx_tot_bytes += skb->len;
return NETDEV_TX_OK; return NETDEV_TX_OK;
......
...@@ -736,10 +736,16 @@ struct nic_rx_stats { ...@@ -736,10 +736,16 @@ struct nic_rx_stats {
u64 fw_err_pko; u64 fw_err_pko;
u64 fw_err_link; u64 fw_err_link;
u64 fw_err_drop; u64 fw_err_drop;
/* LRO */
u64 fw_lro_pkts; /* Number of packets that are LROed */ u64 fw_lro_pkts; /* Number of packets that are LROed */
u64 fw_lro_octs; /* Number of octets that are LROed */ u64 fw_lro_octs; /* Number of octets that are LROed */
u64 fw_total_lro; /* Number of LRO packets formed */ u64 fw_total_lro; /* Number of LRO packets formed */
u64 fw_lro_aborts; /* Number of times lRO of packet aborted */ u64 fw_lro_aborts; /* Number of times lRO of packet aborted */
u64 fw_lro_aborts_port;
u64 fw_lro_aborts_seq;
u64 fw_lro_aborts_tsval;
u64 fw_lro_aborts_timer;
/* intrmod: packet forward rate */ /* intrmod: packet forward rate */
u64 fwd_rate; u64 fwd_rate;
}; };
...@@ -763,9 +769,13 @@ struct nic_tx_stats { ...@@ -763,9 +769,13 @@ struct nic_tx_stats {
/* firmware stats */ /* firmware stats */
u64 fw_total_sent; u64 fw_total_sent;
u64 fw_total_fwd; u64 fw_total_fwd;
u64 fw_total_fwd_bytes;
u64 fw_err_pko; u64 fw_err_pko;
u64 fw_err_link; u64 fw_err_link;
u64 fw_err_drop; u64 fw_err_drop;
u64 fw_err_tso;
u64 fw_tso; /* number of tso requests */
u64 fw_tso_fwd; /* number of packets segmented in tso */
}; };
struct oct_link_stats { struct oct_link_stats {
......
...@@ -394,6 +394,12 @@ struct octeon_device { ...@@ -394,6 +394,12 @@ struct octeon_device {
struct cavium_wk console_poll_work[MAX_OCTEON_MAPS]; struct cavium_wk console_poll_work[MAX_OCTEON_MAPS];
void *priv; void *priv;
int rx_pause;
int tx_pause;
struct oct_link_stats link_stats; /*stastics from firmware*/
}; };
#define OCT_DRV_ONLINE 1 #define OCT_DRV_ONLINE 1
......
...@@ -65,6 +65,10 @@ struct oct_iq_stats { ...@@ -65,6 +65,10 @@ struct oct_iq_stats {
u64 tx_iq_busy;/**< Numof times this iq was found to be full. */ u64 tx_iq_busy;/**< Numof times this iq was found to be full. */
u64 tx_dropped;/**< Numof pkts dropped dueto xmitpath errors. */ u64 tx_dropped;/**< Numof pkts dropped dueto xmitpath errors. */
u64 tx_tot_bytes;/**< Total count of bytes sento to network. */ u64 tx_tot_bytes;/**< Total count of bytes sento to network. */
u64 tx_gso; /* count of tso */
u64 tx_dmamap_fail;
u64 tx_restart;
/*u64 tx_timeout_count;*/
}; };
#define OCT_IQ_STATS_SIZE (sizeof(struct oct_iq_stats)) #define OCT_IQ_STATS_SIZE (sizeof(struct oct_iq_stats))
......
...@@ -30,6 +30,17 @@ ...@@ -30,6 +30,17 @@
#include <linux/dma-mapping.h> #include <linux/dma-mapping.h>
#include <linux/ptp_clock_kernel.h> #include <linux/ptp_clock_kernel.h>
struct oct_nic_stats_resp {
u64 rh;
struct oct_link_stats stats;
u64 status;
};
struct oct_nic_stats_ctrl {
struct completion complete;
struct net_device *netdev;
};
/** LiquidIO per-interface network private data */ /** LiquidIO per-interface network private data */
struct lio { struct lio {
/** State of the interface. Rx/Tx happens only in the RUNNING state. */ /** State of the interface. Rx/Tx happens only in the RUNNING state. */
......
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