Module Name: src
Committed By: msaitoh
Date: Tue Oct 3 02:55:37 UTC 2017
Modified Files:
src/sys/dev/pci/ixgbe: ixgbe_mbx.c ixgbe_type.h ixv.c
Log Message:
Make mailbox statistic counters evcnt(9).
Example:
> ixv0 message TXs 23 0 misc
> ixv0 message RXs 2911 0 misc
> ixv0 ACKs 23 0 misc
> ixv0 REQs 22 0 misc
> ixv0 RSTs 0 0 misc
To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/pci/ixgbe/ixgbe_mbx.c
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/pci/ixgbe/ixgbe_type.h
cvs rdiff -u -r1.66 -r1.67 src/sys/dev/pci/ixgbe/ixv.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/pci/ixgbe/ixgbe_mbx.c
diff -u src/sys/dev/pci/ixgbe/ixgbe_mbx.c:1.7 src/sys/dev/pci/ixgbe/ixgbe_mbx.c:1.8
--- src/sys/dev/pci/ixgbe/ixgbe_mbx.c:1.7 Wed Aug 30 08:49:18 2017
+++ src/sys/dev/pci/ixgbe/ixgbe_mbx.c Tue Oct 3 02:55:37 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_mbx.c,v 1.7 2017/08/30 08:49:18 msaitoh Exp $ */
+/* $NetBSD: ixgbe_mbx.c,v 1.8 2017/10/03 02:55:37 msaitoh Exp $ */
/******************************************************************************
@@ -231,7 +231,7 @@ static s32 ixgbe_check_for_msg_vf(struct
if (!ixgbe_check_for_bit_vf(hw, IXGBE_VFMAILBOX_PFSTS)) {
ret_val = IXGBE_SUCCESS;
- hw->mbx.stats.reqs++;
+ hw->mbx.stats.reqs.ev_count++;
}
return ret_val;
@@ -253,7 +253,7 @@ static s32 ixgbe_check_for_ack_vf(struct
if (!ixgbe_check_for_bit_vf(hw, IXGBE_VFMAILBOX_PFACK)) {
ret_val = IXGBE_SUCCESS;
- hw->mbx.stats.acks++;
+ hw->mbx.stats.acks.ev_count++;
}
return ret_val;
@@ -276,7 +276,7 @@ static s32 ixgbe_check_for_rst_vf(struct
if (!ixgbe_check_for_bit_vf(hw, (IXGBE_VFMAILBOX_RSTD |
IXGBE_VFMAILBOX_RSTI))) {
ret_val = IXGBE_SUCCESS;
- hw->mbx.stats.rsts++;
+ hw->mbx.stats.rsts.ev_count++;
}
return ret_val;
@@ -337,7 +337,7 @@ static s32 ixgbe_write_mbx_vf(struct ixg
IXGBE_WRITE_REG_ARRAY(hw, IXGBE_VFMBMEM, i, msg[i]);
/* update stats */
- hw->mbx.stats.msgs_tx++;
+ hw->mbx.stats.msgs_tx.ev_count++;
/* Drop VFU and interrupt the PF to tell it a message has been sent */
IXGBE_WRITE_REG(hw, IXGBE_VFMAILBOX, IXGBE_VFMAILBOX_REQ);
@@ -377,7 +377,7 @@ static s32 ixgbe_read_mbx_vf(struct ixgb
IXGBE_WRITE_REG(hw, IXGBE_VFMAILBOX, IXGBE_VFMAILBOX_ACK);
/* update stats */
- hw->mbx.stats.msgs_rx++;
+ hw->mbx.stats.msgs_rx.ev_count++;
out_no_read:
return ret_val;
@@ -408,11 +408,11 @@ void ixgbe_init_mbx_params_vf(struct ixg
mbx->ops.check_for_ack = ixgbe_check_for_ack_vf;
mbx->ops.check_for_rst = ixgbe_check_for_rst_vf;
- mbx->stats.msgs_tx = 0;
- mbx->stats.msgs_rx = 0;
- mbx->stats.reqs = 0;
- mbx->stats.acks = 0;
- mbx->stats.rsts = 0;
+ mbx->stats.msgs_tx.ev_count = 0;
+ mbx->stats.msgs_rx.ev_count = 0;
+ mbx->stats.reqs.ev_count = 0;
+ mbx->stats.acks.ev_count = 0;
+ mbx->stats.rsts.ev_count = 0;
}
static s32 ixgbe_check_for_bit_pf(struct ixgbe_hw *hw, u32 mask, s32 index)
@@ -446,7 +446,7 @@ static s32 ixgbe_check_for_msg_pf(struct
if (!ixgbe_check_for_bit_pf(hw, IXGBE_MBVFICR_VFREQ_VF1 << vf_bit,
index)) {
ret_val = IXGBE_SUCCESS;
- hw->mbx.stats.reqs++;
+ hw->mbx.stats.reqs.ev_count++;
}
return ret_val;
@@ -470,7 +470,7 @@ static s32 ixgbe_check_for_ack_pf(struct
if (!ixgbe_check_for_bit_pf(hw, IXGBE_MBVFICR_VFACK_VF1 << vf_bit,
index)) {
ret_val = IXGBE_SUCCESS;
- hw->mbx.stats.acks++;
+ hw->mbx.stats.acks.ev_count++;
}
return ret_val;
@@ -509,7 +509,7 @@ static s32 ixgbe_check_for_rst_pf(struct
if (vflre & (1 << vf_shift)) {
ret_val = IXGBE_SUCCESS;
IXGBE_WRITE_REG(hw, IXGBE_VFLREC(reg_offset), (1 << vf_shift));
- hw->mbx.stats.rsts++;
+ hw->mbx.stats.rsts.ev_count++;
}
return ret_val;
@@ -578,7 +578,7 @@ static s32 ixgbe_write_mbx_pf(struct ixg
IXGBE_WRITE_REG(hw, IXGBE_PFMAILBOX(vf_number), IXGBE_PFMAILBOX_STS);
/* update stats */
- hw->mbx.stats.msgs_tx++;
+ hw->mbx.stats.msgs_tx.ev_count++;
out_no_write:
return ret_val;
@@ -617,7 +617,7 @@ static s32 ixgbe_read_mbx_pf(struct ixgb
IXGBE_WRITE_REG(hw, IXGBE_PFMAILBOX(vf_number), IXGBE_PFMAILBOX_ACK);
/* update stats */
- hw->mbx.stats.msgs_rx++;
+ hw->mbx.stats.msgs_rx.ev_count++;
out_no_read:
return ret_val;
@@ -653,9 +653,9 @@ void ixgbe_init_mbx_params_pf(struct ixg
mbx->ops.check_for_ack = ixgbe_check_for_ack_pf;
mbx->ops.check_for_rst = ixgbe_check_for_rst_pf;
- mbx->stats.msgs_tx = 0;
- mbx->stats.msgs_rx = 0;
- mbx->stats.reqs = 0;
- mbx->stats.acks = 0;
- mbx->stats.rsts = 0;
+ mbx->stats.msgs_tx.ev_count = 0;
+ mbx->stats.msgs_rx.ev_count = 0;
+ mbx->stats.reqs.ev_count = 0;
+ mbx->stats.acks.ev_count = 0;
+ mbx->stats.rsts.ev_count = 0;
}
Index: src/sys/dev/pci/ixgbe/ixgbe_type.h
diff -u src/sys/dev/pci/ixgbe/ixgbe_type.h:1.27 src/sys/dev/pci/ixgbe/ixgbe_type.h:1.28
--- src/sys/dev/pci/ixgbe/ixgbe_type.h:1.27 Thu Sep 14 09:25:58 2017
+++ src/sys/dev/pci/ixgbe/ixgbe_type.h Tue Oct 3 02:55:37 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_type.h,v 1.27 2017/09/14 09:25:58 msaitoh Exp $ */
+/* $NetBSD: ixgbe_type.h,v 1.28 2017/10/03 02:55:37 msaitoh Exp $ */
/******************************************************************************
@@ -4137,12 +4137,12 @@ struct ixgbe_mbx_operations {
};
struct ixgbe_mbx_stats {
- u32 msgs_tx;
- u32 msgs_rx;
+ struct evcnt msgs_tx;
+ struct evcnt msgs_rx;
- u32 acks;
- u32 reqs;
- u32 rsts;
+ struct evcnt acks;
+ struct evcnt reqs;
+ struct evcnt rsts;
};
struct ixgbe_mbx_info {
Index: src/sys/dev/pci/ixgbe/ixv.c
diff -u src/sys/dev/pci/ixgbe/ixv.c:1.66 src/sys/dev/pci/ixgbe/ixv.c:1.67
--- src/sys/dev/pci/ixgbe/ixv.c:1.66 Wed Sep 27 10:31:29 2017
+++ src/sys/dev/pci/ixgbe/ixv.c Tue Oct 3 02:55:37 2017
@@ -1,4 +1,4 @@
-/*$NetBSD: ixv.c,v 1.66 2017/09/27 10:31:29 msaitoh Exp $*/
+/*$NetBSD: ixv.c,v 1.67 2017/10/03 02:55:37 msaitoh Exp $*/
/******************************************************************************
@@ -547,6 +547,7 @@ static int
ixv_detach(device_t dev, int flags)
{
struct adapter *adapter = device_private(dev);
+ struct ixgbe_hw *hw = &adapter->hw;
struct ix_queue *que = adapter->queues;
struct tx_ring *txr = adapter->tx_rings;
struct rx_ring *rxr = adapter->rx_rings;
@@ -649,6 +650,13 @@ ixv_detach(device_t dev, int flags)
evcnt_detach(&stats->vfgotc);
evcnt_detach(&stats->vfgptc);
+ /* Mailbox Stats */
+ evcnt_detach(&hw->mbx.stats.msgs_tx);
+ evcnt_detach(&hw->mbx.stats.msgs_rx);
+ evcnt_detach(&hw->mbx.stats.acks);
+ evcnt_detach(&hw->mbx.stats.reqs);
+ evcnt_detach(&hw->mbx.stats.rsts);
+
ixgbe_free_transmit_structures(adapter);
ixgbe_free_receive_structures(adapter);
free(adapter->queues, M_DEVBUF);
@@ -2083,6 +2091,7 @@ ixv_add_stats_sysctls(struct adapter *ad
struct tx_ring *txr = adapter->tx_rings;
struct rx_ring *rxr = adapter->rx_rings;
struct ixgbevf_hw_stats *stats = &adapter->stats.vf;
+ struct ixgbe_hw *hw = &adapter->hw;
const struct sysctlnode *rnode;
struct sysctllog **log = &adapter->sysctllog;
const char *xname = device_xname(dev);
@@ -2243,6 +2252,19 @@ ixv_add_stats_sysctls(struct adapter *ad
xname, "Good Packets Transmitted");
evcnt_attach_dynamic(&stats->vfgotc, EVCNT_TYPE_MISC, NULL,
xname, "Good Octets Transmitted");
+
+ /* Mailbox Stats */
+ evcnt_attach_dynamic(&hw->mbx.stats.msgs_tx, EVCNT_TYPE_MISC, NULL,
+ xname, "message TXs");
+ evcnt_attach_dynamic(&hw->mbx.stats.msgs_rx, EVCNT_TYPE_MISC, NULL,
+ xname, "message RXs");
+ evcnt_attach_dynamic(&hw->mbx.stats.acks, EVCNT_TYPE_MISC, NULL,
+ xname, "ACKs");
+ evcnt_attach_dynamic(&hw->mbx.stats.reqs, EVCNT_TYPE_MISC, NULL,
+ xname, "REQs");
+ evcnt_attach_dynamic(&hw->mbx.stats.rsts, EVCNT_TYPE_MISC, NULL,
+ xname, "RSTs");
+
} /* ixv_add_stats_sysctls */
/************************************************************************