Skip to content

Commit

Permalink
OS-5723 ixgbe has uninitialized kstat fields
Browse files Browse the repository at this point in the history
Reviewed by: Patrick Mooney <patrick.mooney@joyent.com>
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Reviewed by: Robert Mustacchi <rm@joyent.com>
Approved by: Jerry Jelinek <jerry.jelinek@joyent.com>
  • Loading branch information
rzezeski committed Feb 25, 2017
1 parent a20a601 commit b3fbfca
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 27 deletions.
6 changes: 3 additions & 3 deletions usr/src/uts/common/io/ixgbe/ixgbe_main.c
Expand Up @@ -25,7 +25,7 @@

/*
* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, Joyent, Inc. All rights reserved.
* Copyright 2017, Joyent, Inc.
* Copyright 2012 Nexenta Systems, Inc. All rights reserved.
* Copyright (c) 2013 Saso Kiselkov. All rights reserved.
* Copyright (c) 2013 OSN Online Service Nuernberg GmbH. All rights reserved.
Expand Down Expand Up @@ -4517,7 +4517,7 @@ ixgbe_intr_tx_work(ixgbe_tx_ring_t *tx_ring)
tx_ring->reschedule = B_FALSE;
mac_tx_ring_update(tx_ring->ixgbe->mac_hdl,
tx_ring->ring_handle);
IXGBE_DEBUG_STAT(tx_ring->stat_reschedule);
tx_ring->stat_reschedule++;
}
}

Expand Down Expand Up @@ -4738,7 +4738,7 @@ ixgbe_intr_legacy(void *arg1, void *arg2)
if (tx_reschedule) {
tx_ring->reschedule = B_FALSE;
mac_tx_ring_update(ixgbe->mac_hdl, tx_ring->ring_handle);
IXGBE_DEBUG_STAT(tx_ring->stat_reschedule);
tx_ring->stat_reschedule++;
}

return (result);
Expand Down
11 changes: 6 additions & 5 deletions usr/src/uts/common/io/ixgbe/ixgbe_rx.c
Expand Up @@ -25,6 +25,7 @@

/*
* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright 2017 Joyent, Inc.
*/

#include "ixgbe_sw.h"
Expand Down Expand Up @@ -601,13 +602,13 @@ ixgbe_ring_rx(ixgbe_rx_ring_t *rx_ring, int poll_bytes)
if ((status_error & IXGBE_RXDADV_ERR_FRAME_ERR_MASK) ||
((!ixgbe->lro_enable) &&
(!(status_error & IXGBE_RXD_STAT_EOP)))) {
IXGBE_DEBUG_STAT(rx_ring->stat_frame_error);
rx_ring->stat_frame_error++;
goto rx_discard;
}

IXGBE_DEBUG_STAT_COND(rx_ring->stat_cksum_error,
(status_error & IXGBE_RXDADV_ERR_TCPE) ||
(status_error & IXGBE_RXDADV_ERR_IPE));
if ((status_error & IXGBE_RXDADV_ERR_TCPE) ||
(status_error & IXGBE_RXDADV_ERR_IPE))
rx_ring->stat_cksum_error++;

if (ixgbe->lro_enable) {
rsc_cnt = (current_rbd->wb.lower.lo_dword.data &
Expand Down Expand Up @@ -716,7 +717,7 @@ ixgbe_ring_rx(ixgbe_rx_ring_t *rx_ring, int poll_bytes)
* per interrupt.
*/
if (++pkt_num > ixgbe->rx_limit_per_intr) {
IXGBE_DEBUG_STAT(rx_ring->stat_exceed_pkt);
rx_ring->stat_exceed_pkt++;
break;
}

Expand Down
5 changes: 1 addition & 4 deletions usr/src/uts/common/io/ixgbe/ixgbe_stat.c
Expand Up @@ -27,6 +27,7 @@
* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright 2012 Nexenta Systems, Inc. All rights reserved.
* Copyright 2016 OmniTI Computer Consulting, Inc. All rights reserved.
* Copyright 2017 Joyent, Inc.
*/

#include "ixgbe_sw.h"
Expand Down Expand Up @@ -58,7 +59,6 @@ ixgbe_update_stats(kstat_t *ks, int rw)
ixgbe_ks->reset_count.value.ui64 = ixgbe->reset_count;
ixgbe_ks->lroc.value.ui64 = ixgbe->lro_pkt_count;

#ifdef IXGBE_DEBUG
ixgbe_ks->rx_frame_error.value.ui64 = 0;
ixgbe_ks->rx_cksum_error.value.ui64 = 0;
ixgbe_ks->rx_exceed_pkt.value.ui64 = 0;
Expand Down Expand Up @@ -88,7 +88,6 @@ ixgbe_update_stats(kstat_t *ks, int rw)
ixgbe_ks->tx_reschedule.value.ui64 +=
ixgbe->tx_rings[i].stat_reschedule;
}
#endif

/*
* Hardware calculated statistics.
Expand Down Expand Up @@ -245,7 +244,6 @@ ixgbe_init_stats(ixgbe_t *ixgbe)
kstat_named_init(&ixgbe_ks->reset_count, "reset_count",
KSTAT_DATA_UINT64);

#ifdef IXGBE_DEBUG
kstat_named_init(&ixgbe_ks->rx_frame_error, "rx_frame_error",
KSTAT_DATA_UINT64);
kstat_named_init(&ixgbe_ks->rx_cksum_error, "rx_cksum_error",
Expand All @@ -262,7 +260,6 @@ ixgbe_init_stats(ixgbe_t *ixgbe)
KSTAT_DATA_UINT64);
kstat_named_init(&ixgbe_ks->tx_reschedule, "tx_reschedule",
KSTAT_DATA_UINT64);
#endif

kstat_named_init(&ixgbe_ks->gprc, "good_pkts_recvd",
KSTAT_DATA_UINT64);
Expand Down
16 changes: 7 additions & 9 deletions usr/src/uts/common/io/ixgbe/ixgbe_sw.h
Expand Up @@ -27,6 +27,7 @@
* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013 Saso Kiselkov. All rights reserved.
* Copyright 2016 OmniTI Computer Consulting, Inc. All rights reserved.
* Copyright 2017 Joyent, Inc.
*/

#ifndef _IXGBE_SW_H
Expand Down Expand Up @@ -505,15 +506,16 @@ typedef struct ixgbe_tx_ring {
uint32_t recycle_fail;
uint32_t stall_watchdog;

#ifdef IXGBE_DEBUG
/*
* Debug statistics
*/
uint32_t stat_overload;
uint32_t stat_fail_no_tbd;
uint32_t stat_fail_no_tcb;
uint32_t stat_fail_dma_bind;
uint32_t stat_reschedule;

#ifdef IXGBE_DEBUG
/*
* Debug statistics
*/
uint32_t stat_break_tbd_limit;
uint32_t stat_lso_header_fail;
#endif
Expand Down Expand Up @@ -580,14 +582,10 @@ typedef struct ixgbe_rx_ring {

kmutex_t rx_lock; /* Rx access lock */

#ifdef IXGBE_DEBUG
/*
* Debug statistics
*/
uint32_t stat_frame_error;
uint32_t stat_cksum_error;
uint32_t stat_exceed_pkt;
#endif

uint64_t stat_rbytes;
uint64_t stat_ipackets;

Expand Down
13 changes: 7 additions & 6 deletions usr/src/uts/common/io/ixgbe/ixgbe_tx.c
Expand Up @@ -27,6 +27,7 @@
* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright 2012 Nexenta Systems, Inc. All rights reserved.
* Copyright 2016 OmniTI Computer Consulting, Inc. All rights reserved.
* Copyright 2017 Joyent, Inc.
*/

#include "ixgbe_sw.h"
Expand Down Expand Up @@ -163,7 +164,7 @@ ixgbe_ring_tx(void *arg, mblk_t *mp)
*/
if (tx_ring->tbd_free < ixgbe->tx_overload_thresh) {
tx_ring->reschedule = B_TRUE;
IXGBE_DEBUG_STAT(tx_ring->stat_overload);
tx_ring->stat_overload++;
return (mp);
}

Expand Down Expand Up @@ -295,7 +296,7 @@ ixgbe_ring_tx(void *arg, mblk_t *mp)
tcb = ixgbe_get_free_list(tx_ring);

if (tcb == NULL) {
IXGBE_DEBUG_STAT(tx_ring->stat_fail_no_tcb);
tx_ring->stat_fail_no_tcb++;
goto tx_failure;
}

Expand Down Expand Up @@ -447,7 +448,7 @@ ixgbe_ring_tx(void *arg, mblk_t *mp)

tcb = ixgbe_get_free_list(tx_ring);
if (tcb == NULL) {
IXGBE_DEBUG_STAT(tx_ring->stat_fail_no_tcb);
tx_ring->stat_fail_no_tcb++;
goto tx_failure;
}
desc_num = ixgbe_tx_copy(tx_ring, tcb, pull_mp,
Expand All @@ -460,7 +461,7 @@ ixgbe_ring_tx(void *arg, mblk_t *mp)

tcb = ixgbe_get_free_list(tx_ring);
if (tcb == NULL) {
IXGBE_DEBUG_STAT(tx_ring->stat_fail_no_tcb);
tx_ring->stat_fail_no_tcb++;
goto tx_failure;
}
if ((ctx != NULL) && ctx->lso_flag) {
Expand Down Expand Up @@ -500,7 +501,7 @@ ixgbe_ring_tx(void *arg, mblk_t *mp)
* parallel.
*/
if (tx_ring->tbd_free <= (desc_total + 1)) {
IXGBE_DEBUG_STAT(tx_ring->stat_fail_no_tbd);
tx_ring->stat_fail_no_tbd++;
mutex_exit(&tx_ring->tx_lock);
goto tx_failure;
}
Expand Down Expand Up @@ -655,7 +656,7 @@ ixgbe_tx_bind(ixgbe_tx_ring_t *tx_ring, tx_control_block_t *tcb, mblk_t *mp,
0, &dma_cookie, &ncookies);

if (status != DDI_DMA_MAPPED) {
IXGBE_DEBUG_STAT(tx_ring->stat_fail_dma_bind);
tx_ring->stat_fail_dma_bind++;
return (-1);
}

Expand Down

0 comments on commit b3fbfca

Please sign in to comment.