summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuri Pankov <yuri.pankov@nexenta.com>2015-12-09 17:20:57 +0300
committerRichard Lowe <richlowe@richlowe.net>2016-05-29 12:15:23 -0400
commitfa4e188e8e6bc718b1a096b3d1dc046952a69304 (patch)
tree41787aa7408e80cd96525696cbe41ec50f24d2be
parent3ba944265c4ae1fcf23ef758537c2e4f4feec16e (diff)
downloadillumos-joyent-fa4e188e8e6bc718b1a096b3d1dc046952a69304.tar.gz
4416 Silence igb(7D) debug messages by default
Reviewed by: Toomas Soome <tsoome@me.com> Reviewed by: Robert Mustacchi <rm@joyent.com> Approved by: Richard Lowe <richlowe@richlowe.net>
-rw-r--r--usr/src/uts/common/io/igb/e1000_osdep.h11
-rw-r--r--usr/src/uts/common/io/igb/igb_buf.c41
-rw-r--r--usr/src/uts/common/io/igb/igb_debug.c134
-rw-r--r--usr/src/uts/common/io/igb/igb_debug.h30
-rw-r--r--usr/src/uts/common/io/igb/igb_log.c67
-rw-r--r--usr/src/uts/common/io/igb/igb_main.c143
-rw-r--r--usr/src/uts/common/io/igb/igb_rx.c3
-rw-r--r--usr/src/uts/common/io/igb/igb_stat.c2
-rw-r--r--usr/src/uts/common/io/igb/igb_sw.h7
-rw-r--r--usr/src/uts/common/io/igb/igb_tx.c11
10 files changed, 215 insertions, 234 deletions
diff --git a/usr/src/uts/common/io/igb/e1000_osdep.h b/usr/src/uts/common/io/igb/e1000_osdep.h
index f9ac1594bf..c0dd4826e7 100644
--- a/usr/src/uts/common/io/igb/e1000_osdep.h
+++ b/usr/src/uts/common/io/igb/e1000_osdep.h
@@ -58,20 +58,17 @@ extern "C" {
#define msec_delay(x) drv_usecwait(x * 1000)
#define msec_delay_irq msec_delay
-#ifdef IGB_DEBUG
#define DEBUGOUT(S) IGB_DEBUGLOG_0(NULL, S)
#define DEBUGOUT1(S, A) IGB_DEBUGLOG_1(NULL, S, A)
#define DEBUGOUT2(S, A, B) IGB_DEBUGLOG_2(NULL, S, A, B)
#define DEBUGOUT3(S, A, B, C) IGB_DEBUGLOG_3(NULL, S, A, B, C)
+
+#ifdef IGB_DEBUG
+#define DEBUGFUNC(F) IGB_DEBUGFUNC(F)
#else
-#define DEBUGOUT(S)
-#define DEBUGOUT1(S, A)
-#define DEBUGOUT2(S, A, B)
-#define DEBUGOUT3(S, A, B, C)
+#define DEBUGFUNC(F)
#endif
-#define DEBUGFUNC(f)
-
#define OS_DEP(hw) ((struct igb_osdep *)((hw)->back))
#define false B_FALSE
diff --git a/usr/src/uts/common/io/igb/igb_buf.c b/usr/src/uts/common/io/igb/igb_buf.c
index beeec6ea3c..1987fe6cfc 100644
--- a/usr/src/uts/common/io/igb/igb_buf.c
+++ b/usr/src/uts/common/io/igb/igb_buf.c
@@ -231,7 +231,7 @@ igb_alloc_tbd_ring(igb_tx_ring_t *tx_ring)
&tx_ring->tbd_area.dma_handle);
if (ret != DDI_SUCCESS) {
- igb_error(igb,
+ igb_log(igb, IGB_LOG_ERROR,
"Could not allocate tbd dma handle: %x", ret);
tx_ring->tbd_area.dma_handle = NULL;
@@ -249,7 +249,7 @@ igb_alloc_tbd_ring(igb_tx_ring_t *tx_ring)
&len, &tx_ring->tbd_area.acc_handle);
if (ret != DDI_SUCCESS) {
- igb_error(igb,
+ igb_log(igb, IGB_LOG_ERROR,
"Could not allocate tbd dma memory: %x", ret);
tx_ring->tbd_area.acc_handle = NULL;
tx_ring->tbd_area.address = NULL;
@@ -276,7 +276,7 @@ igb_alloc_tbd_ring(igb_tx_ring_t *tx_ring)
DDI_DMA_DONTWAIT, NULL, &cookie, &cookie_num);
if (ret != DDI_DMA_MAPPED) {
- igb_error(igb,
+ igb_log(igb, IGB_LOG_ERROR,
"Could not bind tbd dma resource: %x", ret);
tx_ring->tbd_area.dma_address = NULL;
if (tx_ring->tbd_area.acc_handle != NULL) {
@@ -339,7 +339,8 @@ igb_alloc_rx_ring_data(igb_rx_ring_t *rx_ring)
rx_data = kmem_zalloc(sizeof (igb_rx_data_t), KM_NOSLEEP);
if (rx_data == NULL) {
- igb_error(igb, "Allocate software receive rings failed");
+ igb_log(igb, IGB_LOG_ERROR,
+ "Allocate software receive rings failed");
return (IGB_FAILURE);
}
@@ -361,7 +362,7 @@ igb_alloc_rx_ring_data(igb_rx_ring_t *rx_ring)
rx_data->ring_size, KM_NOSLEEP);
if (rx_data->work_list == NULL) {
- igb_error(igb,
+ igb_log(igb, IGB_LOG_ERROR,
"Could not allocate memory for rx work list");
goto alloc_rx_data_failure;
}
@@ -373,7 +374,7 @@ igb_alloc_rx_ring_data(igb_rx_ring_t *rx_ring)
rx_data->free_list_size, KM_NOSLEEP);
if (rx_data->free_list == NULL) {
- igb_error(igb,
+ igb_log(igb, IGB_LOG_ERROR,
"Cound not allocate memory for rx free list");
goto alloc_rx_data_failure;
}
@@ -388,7 +389,7 @@ igb_alloc_rx_ring_data(igb_rx_ring_t *rx_ring)
KM_NOSLEEP);
if (rx_data->rcb_area == NULL) {
- igb_error(igb,
+ igb_log(igb, IGB_LOG_ERROR,
"Cound not allocate memory for rx control blocks");
goto alloc_rx_data_failure;
}
@@ -460,7 +461,7 @@ igb_alloc_rbd_ring(igb_rx_data_t *rx_data)
&rx_data->rbd_area.dma_handle);
if (ret != DDI_SUCCESS) {
- igb_error(igb,
+ igb_log(igb, IGB_LOG_ERROR,
"Could not allocate rbd dma handle: %x", ret);
rx_data->rbd_area.dma_handle = NULL;
return (IGB_FAILURE);
@@ -477,7 +478,7 @@ igb_alloc_rbd_ring(igb_rx_data_t *rx_data)
&len, &rx_data->rbd_area.acc_handle);
if (ret != DDI_SUCCESS) {
- igb_error(igb,
+ igb_log(igb, IGB_LOG_ERROR,
"Could not allocate rbd dma memory: %x", ret);
rx_data->rbd_area.acc_handle = NULL;
rx_data->rbd_area.address = NULL;
@@ -503,7 +504,7 @@ igb_alloc_rbd_ring(igb_rx_data_t *rx_data)
DDI_DMA_DONTWAIT, NULL, &cookie, &cookie_num);
if (ret != DDI_DMA_MAPPED) {
- igb_error(igb,
+ igb_log(igb, IGB_LOG_ERROR,
"Could not bind rbd dma resource: %x", ret);
rx_data->rbd_area.dma_address = NULL;
if (rx_data->rbd_area.acc_handle != NULL) {
@@ -573,7 +574,7 @@ igb_alloc_dma_buffer(igb_t *igb,
if (ret != DDI_SUCCESS) {
buf->dma_handle = NULL;
- igb_error(igb,
+ igb_log(igb, IGB_LOG_ERROR,
"Could not allocate dma buffer handle: %x", ret);
return (IGB_FAILURE);
}
@@ -590,7 +591,7 @@ igb_alloc_dma_buffer(igb_t *igb,
ddi_dma_free_handle(&buf->dma_handle);
buf->dma_handle = NULL;
}
- igb_error(igb,
+ igb_log(igb, IGB_LOG_ERROR,
"Could not allocate dma buffer memory: %x", ret);
return (IGB_FAILURE);
}
@@ -611,7 +612,7 @@ igb_alloc_dma_buffer(igb_t *igb,
ddi_dma_free_handle(&buf->dma_handle);
buf->dma_handle = NULL;
}
- igb_error(igb,
+ igb_log(igb, IGB_LOG_ERROR,
"Could not bind dma buffer handle: %x", ret);
return (IGB_FAILURE);
}
@@ -674,7 +675,7 @@ igb_alloc_tcb_lists(igb_tx_ring_t *tx_ring)
tx_ring->ring_size, KM_NOSLEEP);
if (tx_ring->work_list == NULL) {
- igb_error(igb,
+ igb_log(igb, IGB_LOG_ERROR,
"Cound not allocate memory for tx work list");
return (IGB_FAILURE);
}
@@ -690,7 +691,7 @@ igb_alloc_tcb_lists(igb_tx_ring_t *tx_ring)
sizeof (tx_control_block_t *) * tx_ring->ring_size);
tx_ring->work_list = NULL;
- igb_error(igb,
+ igb_log(igb, IGB_LOG_ERROR,
"Cound not allocate memory for tx free list");
return (IGB_FAILURE);
}
@@ -711,7 +712,7 @@ igb_alloc_tcb_lists(igb_tx_ring_t *tx_ring)
sizeof (tx_control_block_t *) * tx_ring->free_list_size);
tx_ring->free_list = NULL;
- igb_error(igb,
+ igb_log(igb, IGB_LOG_ERROR,
"Cound not allocate memory for tx control blocks");
return (IGB_FAILURE);
}
@@ -736,7 +737,7 @@ igb_alloc_tcb_lists(igb_tx_ring_t *tx_ring)
&tcb->tx_dma_handle);
if (ret != DDI_SUCCESS) {
tcb->tx_dma_handle = NULL;
- igb_error(igb,
+ igb_log(igb, IGB_LOG_ERROR,
"Could not allocate tx dma handle: %x", ret);
goto alloc_tcb_lists_fail;
}
@@ -754,7 +755,8 @@ igb_alloc_tcb_lists(igb_tx_ring_t *tx_ring)
ASSERT(tcb->tx_dma_handle != NULL);
ddi_dma_free_handle(&tcb->tx_dma_handle);
tcb->tx_dma_handle = NULL;
- igb_error(igb, "Allocate tx dma buffer failed");
+ igb_log(igb, IGB_LOG_ERROR,
+ "Allocate tx dma buffer failed");
goto alloc_tcb_lists_fail;
}
tcb->last_index = MAX_TX_RING_SIZE;
@@ -856,7 +858,8 @@ igb_alloc_rcb_lists(igb_rx_data_t *rx_data)
rx_buf, igb->rx_buf_size);
if (ret != IGB_SUCCESS) {
- igb_error(igb, "Allocate rx dma buffer failed");
+ igb_log(igb, IGB_LOG_ERROR,
+ "Allocate rx dma buffer failed");
goto alloc_rcb_lists_fail;
}
diff --git a/usr/src/uts/common/io/igb/igb_debug.c b/usr/src/uts/common/io/igb/igb_debug.c
index 889ff34997..2ceb02eae4 100644
--- a/usr/src/uts/common/io/igb/igb_debug.c
+++ b/usr/src/uts/common/io/igb/igb_debug.c
@@ -29,6 +29,8 @@
#include "igb_sw.h"
#include "igb_debug.h"
+igb_debug_t igb_debug = IGB_LOG_ERROR;
+
#ifdef IGB_DEBUG
extern ddi_device_acc_attr_t igb_regs_acc_attr;
@@ -54,241 +56,241 @@ pci_dump(void *arg)
handle = igb->osdep.cfg_handle;
- igb_log(igb, "Begin dump PCI config space");
+ igb_log(igb, IGB_LOG_INFO, "Begin dump PCI config space");
- igb_log(igb,
+ igb_log(igb, IGB_LOG_INFO,
"PCI_CONF_VENID:\t0x%x\n",
pci_config_get16(handle, PCI_CONF_VENID));
- igb_log(igb,
+ igb_log(igb, IGB_LOG_INFO,
"PCI_CONF_DEVID:\t0x%x\n",
pci_config_get16(handle, PCI_CONF_DEVID));
- igb_log(igb,
+ igb_log(igb, IGB_LOG_INFO,
"PCI_CONF_COMMAND:\t0x%x\n",
pci_config_get16(handle, PCI_CONF_COMM));
- igb_log(igb,
+ igb_log(igb, IGB_LOG_INFO,
"PCI_CONF_STATUS:\t0x%x\n",
pci_config_get16(handle, PCI_CONF_STAT));
- igb_log(igb,
+ igb_log(igb, IGB_LOG_INFO,
"PCI_CONF_REVID:\t0x%x\n",
pci_config_get8(handle, PCI_CONF_REVID));
- igb_log(igb,
+ igb_log(igb, IGB_LOG_INFO,
"PCI_CONF_PROG_CLASS:\t0x%x\n",
pci_config_get8(handle, PCI_CONF_PROGCLASS));
- igb_log(igb,
+ igb_log(igb, IGB_LOG_INFO,
"PCI_CONF_SUB_CLASS:\t0x%x\n",
pci_config_get8(handle, PCI_CONF_SUBCLASS));
- igb_log(igb,
+ igb_log(igb, IGB_LOG_INFO,
"PCI_CONF_BAS_CLASS:\t0x%x\n",
pci_config_get8(handle, PCI_CONF_BASCLASS));
- igb_log(igb,
+ igb_log(igb, IGB_LOG_INFO,
"PCI_CONF_CACHE_LINESZ:\t0x%x\n",
pci_config_get8(handle, PCI_CONF_CACHE_LINESZ));
- igb_log(igb,
+ igb_log(igb, IGB_LOG_INFO,
"PCI_CONF_LATENCY_TIMER:\t0x%x\n",
pci_config_get8(handle, PCI_CONF_LATENCY_TIMER));
- igb_log(igb,
+ igb_log(igb, IGB_LOG_INFO,
"PCI_CONF_HEADER_TYPE:\t0x%x\n",
pci_config_get8(handle, PCI_CONF_HEADER));
- igb_log(igb,
+ igb_log(igb, IGB_LOG_INFO,
"PCI_CONF_BIST:\t0x%x\n",
pci_config_get8(handle, PCI_CONF_BIST));
- igb_log(igb,
+ igb_log(igb, IGB_LOG_INFO,
"PCI_CONF_BASE0:\t0x%x\n",
pci_config_get32(handle, PCI_CONF_BASE0));
- igb_log(igb,
+ igb_log(igb, IGB_LOG_INFO,
"PCI_CONF_BASE1:\t0x%x\n",
pci_config_get32(handle, PCI_CONF_BASE1));
- igb_log(igb,
+ igb_log(igb, IGB_LOG_INFO,
"PCI_CONF_BASE2:\t0x%x\n",
pci_config_get32(handle, PCI_CONF_BASE2));
/* MSI-X BAR */
msix_bar = pci_config_get32(handle, PCI_CONF_BASE3);
- igb_log(igb,
+ igb_log(igb, IGB_LOG_INFO,
"PCI_CONF_BASE3:\t0x%x\n", msix_bar);
- igb_log(igb,
+ igb_log(igb, IGB_LOG_INFO,
"PCI_CONF_BASE4:\t0x%x\n",
pci_config_get32(handle, PCI_CONF_BASE4));
- igb_log(igb,
+ igb_log(igb, IGB_LOG_INFO,
"PCI_CONF_BASE5:\t0x%x\n",
pci_config_get32(handle, PCI_CONF_BASE5));
- igb_log(igb,
+ igb_log(igb, IGB_LOG_INFO,
"PCI_CONF_CIS:\t0x%x\n",
pci_config_get32(handle, PCI_CONF_CIS));
- igb_log(igb,
+ igb_log(igb, IGB_LOG_INFO,
"PCI_CONF_SUBVENID:\t0x%x\n",
pci_config_get16(handle, PCI_CONF_SUBVENID));
- igb_log(igb,
+ igb_log(igb, IGB_LOG_INFO,
"PCI_CONF_SUBSYSID:\t0x%x\n",
pci_config_get16(handle, PCI_CONF_SUBSYSID));
- igb_log(igb,
+ igb_log(igb, IGB_LOG_INFO,
"PCI_CONF_ROM:\t0x%x\n",
pci_config_get32(handle, PCI_CONF_ROM));
cap_ptr = pci_config_get8(handle, PCI_CONF_CAP_PTR);
- igb_log(igb,
+ igb_log(igb, IGB_LOG_INFO,
"PCI_CONF_CAP_PTR:\t0x%x\n", cap_ptr);
- igb_log(igb,
+ igb_log(igb, IGB_LOG_INFO,
"PCI_CONF_ILINE:\t0x%x\n",
pci_config_get8(handle, PCI_CONF_ILINE));
- igb_log(igb,
+ igb_log(igb, IGB_LOG_INFO,
"PCI_CONF_IPIN:\t0x%x\n",
pci_config_get8(handle, PCI_CONF_IPIN));
- igb_log(igb,
+ igb_log(igb, IGB_LOG_INFO,
"PCI_CONF_MIN_G:\t0x%x\n",
pci_config_get8(handle, PCI_CONF_MIN_G));
- igb_log(igb,
+ igb_log(igb, IGB_LOG_INFO,
"PCI_CONF_MAX_L:\t0x%x\n",
pci_config_get8(handle, PCI_CONF_MAX_L));
/* Power Management */
offset = cap_ptr;
- igb_log(igb,
+ igb_log(igb, IGB_LOG_INFO,
"PCI_PM_CAP_ID:\t0x%x\n",
pci_config_get8(handle, offset));
next_ptr = pci_config_get8(handle, offset + 1);
- igb_log(igb,
+ igb_log(igb, IGB_LOG_INFO,
"PCI_PM_NEXT_PTR:\t0x%x\n", next_ptr);
- igb_log(igb,
+ igb_log(igb, IGB_LOG_INFO,
"PCI_PM_CAP:\t0x%x\n",
pci_config_get16(handle, offset + PCI_PMCAP));
- igb_log(igb,
+ igb_log(igb, IGB_LOG_INFO,
"PCI_PM_CSR:\t0x%x\n",
pci_config_get16(handle, offset + PCI_PMCSR));
- igb_log(igb,
+ igb_log(igb, IGB_LOG_INFO,
"PCI_PM_CSR_BSE:\t0x%x\n",
pci_config_get8(handle, offset + PCI_PMCSR_BSE));
- igb_log(igb,
+ igb_log(igb, IGB_LOG_INFO,
"PCI_PM_DATA:\t0x%x\n",
pci_config_get8(handle, offset + PCI_PMDATA));
/* MSI Configuration */
offset = next_ptr;
- igb_log(igb,
+ igb_log(igb, IGB_LOG_INFO,
"PCI_MSI_CAP_ID:\t0x%x\n",
pci_config_get8(handle, offset));
next_ptr = pci_config_get8(handle, offset + 1);
- igb_log(igb,
+ igb_log(igb, IGB_LOG_INFO,
"PCI_MSI_NEXT_PTR:\t0x%x\n", next_ptr);
- igb_log(igb,
+ igb_log(igb, IGB_LOG_INFO,
"PCI_MSI_CTRL:\t0x%x\n",
pci_config_get16(handle, offset + PCI_MSI_CTRL));
- igb_log(igb,
+ igb_log(igb, IGB_LOG_INFO,
"PCI_MSI_ADDR:\t0x%x\n",
pci_config_get32(handle, offset + PCI_MSI_ADDR_OFFSET));
- igb_log(igb,
+ igb_log(igb, IGB_LOG_INFO,
"PCI_MSI_ADDR_HI:\t0x%x\n",
pci_config_get32(handle, offset + 0x8));
- igb_log(igb,
+ igb_log(igb, IGB_LOG_INFO,
"PCI_MSI_DATA:\t0x%x\n",
pci_config_get16(handle, offset + 0xC));
/* MSI-X Configuration */
offset = next_ptr;
- igb_log(igb,
+ igb_log(igb, IGB_LOG_INFO,
"PCI_MSIX_CAP_ID:\t0x%x\n",
pci_config_get8(handle, offset));
next_ptr = pci_config_get8(handle, offset + 1);
- igb_log(igb,
+ igb_log(igb, IGB_LOG_INFO,
"PCI_MSIX_NEXT_PTR:\t0x%x\n", next_ptr);
msix_ctrl = pci_config_get16(handle, offset + PCI_MSIX_CTRL);
msix_tbl_sz = msix_ctrl & 0x7ff;
- igb_log(igb,
+ igb_log(igb, IGB_LOG_INFO,
"PCI_MSIX_CTRL:\t0x%x\n", msix_ctrl);
tbl_offset = pci_config_get32(handle, offset + PCI_MSIX_TBL_OFFSET);
tbl_bir = tbl_offset & PCI_MSIX_TBL_BIR_MASK;
tbl_offset = tbl_offset & ~PCI_MSIX_TBL_BIR_MASK;
- igb_log(igb,
+ igb_log(igb, IGB_LOG_INFO,
"PCI_MSIX_TBL_OFFSET:\t0x%x\n", tbl_offset);
- igb_log(igb,
+ igb_log(igb, IGB_LOG_INFO,
"PCI_MSIX_TBL_BIR:\t0x%x\n", tbl_bir);
pba_offset = pci_config_get32(handle, offset + PCI_MSIX_PBA_OFFSET);
pba_bir = pba_offset & PCI_MSIX_PBA_BIR_MASK;
pba_offset = pba_offset & ~PCI_MSIX_PBA_BIR_MASK;
- igb_log(igb,
+ igb_log(igb, IGB_LOG_INFO,
"PCI_MSIX_PBA_OFFSET:\t0x%x\n", pba_offset);
- igb_log(igb,
+ igb_log(igb, IGB_LOG_INFO,
"PCI_MSIX_PBA_BIR:\t0x%x\n", pba_bir);
/* PCI Express Configuration */
offset = next_ptr;
- igb_log(igb,
+ igb_log(igb, IGB_LOG_INFO,
"PCIE_CAP_ID:\t0x%x\n",
pci_config_get8(handle, offset + PCIE_CAP_ID));
next_ptr = pci_config_get8(handle, offset + PCIE_CAP_NEXT_PTR);
- igb_log(igb,
+ igb_log(igb, IGB_LOG_INFO,
"PCIE_CAP_NEXT_PTR:\t0x%x\n", next_ptr);
- igb_log(igb,
+ igb_log(igb, IGB_LOG_INFO,
"PCIE_PCIECAP:\t0x%x\n",
pci_config_get16(handle, offset + PCIE_PCIECAP));
- igb_log(igb,
+ igb_log(igb, IGB_LOG_INFO,
"PCIE_DEVCAP:\t0x%x\n",
pci_config_get32(handle, offset + PCIE_DEVCAP));
- igb_log(igb,
+ igb_log(igb, IGB_LOG_INFO,
"PCIE_DEVCTL:\t0x%x\n",
pci_config_get16(handle, offset + PCIE_DEVCTL));
- igb_log(igb,
+ igb_log(igb, IGB_LOG_INFO,
"PCIE_DEVSTS:\t0x%x\n",
pci_config_get16(handle, offset + PCIE_DEVSTS));
- igb_log(igb,
+ igb_log(igb, IGB_LOG_INFO,
"PCIE_LINKCAP:\t0x%x\n",
pci_config_get32(handle, offset + PCIE_LINKCAP));
- igb_log(igb,
+ igb_log(igb, IGB_LOG_INFO,
"PCIE_LINKCTL:\t0x%x\n",
pci_config_get16(handle, offset + PCIE_LINKCTL));
- igb_log(igb,
+ igb_log(igb, IGB_LOG_INFO,
"PCIE_LINKSTS:\t0x%x\n",
pci_config_get16(handle, offset + PCIE_LINKSTS));
/* MSI-X Memory Space */
if (ddi_dev_regsize(igb->dip, IGB_ADAPTER_MSIXTAB, &mem_size) !=
DDI_SUCCESS) {
- igb_log(igb, "ddi_dev_regsize() failed");
+ igb_log(igb, IGB_LOG_INFO, "ddi_dev_regsize() failed");
return;
}
if ((ddi_regs_map_setup(igb->dip, IGB_ADAPTER_MSIXTAB, (caddr_t *)&base,
0, mem_size, &igb_regs_acc_attr, &acc_hdl)) != DDI_SUCCESS) {
- igb_log(igb, "ddi_regs_map_setup() failed");
+ igb_log(igb, IGB_LOG_INFO, "ddi_regs_map_setup() failed");
return;
}
- igb_log(igb, "MSI-X Memory Space: (mem_size = %d, base = %x)",
- mem_size, base);
+ igb_log(igb, IGB_LOG_INFO, "MSI-X Memory Space: "
+ "(mem_size = %d, base = %x)", mem_size, base);
for (i = 0; i <= msix_tbl_sz; i++) {
- igb_log(igb, "MSI-X Table Entry(%d):", i);
- igb_log(igb, "lo_addr:\t%x",
+ igb_log(igb, IGB_LOG_INFO, "MSI-X Table Entry(%d):", i);
+ igb_log(igb, IGB_LOG_INFO, "lo_addr:\t%x",
ddi_get32(acc_hdl,
(uint32_t *)(base + tbl_offset + (i * 16))));
- igb_log(igb, "up_addr:\t%x",
+ igb_log(igb, IGB_LOG_INFO, "up_addr:\t%x",
ddi_get32(acc_hdl,
(uint32_t *)(base + tbl_offset + (i * 16) + 4)));
- igb_log(igb, "msg_data:\t%x",
+ igb_log(igb, IGB_LOG_INFO, "msg_data:\t%x",
ddi_get32(acc_hdl,
(uint32_t *)(base + tbl_offset + (i * 16) + 8)));
- igb_log(igb, "vct_ctrl:\t%x",
+ igb_log(igb, IGB_LOG_INFO, "vct_ctrl:\t%x",
ddi_get32(acc_hdl,
(uint32_t *)(base + tbl_offset + (i * 16) + 12)));
}
- igb_log(igb, "MSI-X Pending Bits:\t%x",
+ igb_log(igb, IGB_LOG_INFO, "MSI-X Pending Bits:\t%x",
ddi_get32(acc_hdl, (uint32_t *)(base + pba_offset)));
ddi_regs_map_free(&acc_hdl);
diff --git a/usr/src/uts/common/io/igb/igb_debug.h b/usr/src/uts/common/io/igb/igb_debug.h
index 3026856360..30b184d597 100644
--- a/usr/src/uts/common/io/igb/igb_debug.h
+++ b/usr/src/uts/common/io/igb/igb_debug.h
@@ -38,41 +38,39 @@ extern "C" {
#define IGB_DEBUG
#endif
-#ifdef IGB_DEBUG
+typedef enum {
+ IGB_LOG_NONE = 0,
+ IGB_LOG_ERROR = 1,
+ IGB_LOG_INFO = 2,
+ IGB_LOG_TRACE = 4
+} igb_debug_t;
#define IGB_DEBUGLOG_0(adapter, fmt) \
- igb_log((adapter), (fmt))
+ igb_log((adapter), (IGB_LOG_INFO), (fmt))
#define IGB_DEBUGLOG_1(adapter, fmt, d1) \
- igb_log((adapter), (fmt), (d1))
+ igb_log((adapter), (IGB_LOG_INFO), (fmt), (d1))
#define IGB_DEBUGLOG_2(adapter, fmt, d1, d2) \
- igb_log((adapter), (fmt), (d1), (d2))
+ igb_log((adapter), (IGB_LOG_INFO), (fmt), (d1), (d2))
#define IGB_DEBUGLOG_3(adapter, fmt, d1, d2, d3) \
- igb_log((adapter), (fmt), (d1), (d2), (d3))
+ igb_log((adapter), (IGB_LOG_INFO), (fmt), (d1), (d2), (d3))
+#ifdef IGB_DEBUG
+#define IGB_DEBUGFUNC(fmt) igb_log((NULL), (IGB_LOG_TRACE), (fmt))
#define IGB_DEBUG_STAT_COND(val, cond) if (cond) (val)++
#define IGB_DEBUG_STAT(val) (val)++
-
#else
-
-#define IGB_DEBUGLOG_0(adapter, fmt)
-#define IGB_DEBUGLOG_1(adapter, fmt, d1)
-#define IGB_DEBUGLOG_2(adapter, fmt, d1, d2)
-#define IGB_DEBUGLOG_3(adapter, fmt, d1, d2, d3)
-
+#define IGB_DEBUGFUNC(fmt)
#define IGB_DEBUG_STAT_COND(val, cond)
#define IGB_DEBUG_STAT(val)
-
#endif /* IGB_DEBUG */
#define IGB_STAT(val) (val)++
#ifdef IGB_DEBUG
-
void pci_dump(void *);
-
#endif /* IGB_DEBUG */
-extern void igb_log(void *, const char *, ...);
+void igb_log(void *, igb_debug_t, const char *, ...);
#ifdef __cplusplus
}
diff --git a/usr/src/uts/common/io/igb/igb_log.c b/usr/src/uts/common/io/igb/igb_log.c
index 48b1e0d502..4c4d0ce341 100644
--- a/usr/src/uts/common/io/igb/igb_log.c
+++ b/usr/src/uts/common/io/igb/igb_log.c
@@ -26,68 +26,45 @@
* Use is subject to license terms of the CDDL.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include "igb_sw.h"
-#define LOG_BUF_LEN 128
-
-/*
- * igb_notice - Report a run-time event (CE_NOTE, to console & log)
- */
-void
-igb_notice(void *arg, const char *fmt, ...)
-{
- igb_t *igbp = (igb_t *)arg;
- char buf[LOG_BUF_LEN];
- va_list ap;
-
- va_start(ap, fmt);
- (void) vsnprintf(buf, sizeof (buf), fmt, ap);
- va_end(ap);
+#define LOG_BUF_LEN 1024
- if (igbp != NULL)
- cmn_err(CE_NOTE, "%s%d: %s", MODULE_NAME, igbp->instance, buf);
- else
- cmn_err(CE_NOTE, "%s: %s", MODULE_NAME, buf);
-}
+extern int igb_debug;
-/*
- * igb_log - Log a run-time event (CE_NOTE, to log only)
- */
void
-igb_log(void *arg, const char *fmt, ...)
+igb_log(void *arg, igb_debug_t level, const char *fmt, ...)
{
igb_t *igbp = (igb_t *)arg;
char buf[LOG_BUF_LEN];
+ int celevel;
va_list ap;
va_start(ap, fmt);
(void) vsnprintf(buf, sizeof (buf), fmt, ap);
va_end(ap);
- if (igbp != NULL)
- cmn_err(CE_NOTE, "!%s%d: %s", MODULE_NAME, igbp->instance, buf);
- else
- cmn_err(CE_NOTE, "!%s: %s", MODULE_NAME, buf);
-}
+ DTRACE_PROBE2(igb__log, igb_t *, igbp, const char *, buf);
-/*
- * igb_error - Log a run-time problem (CE_WARN, to log only)
- */
-void
-igb_error(void *arg, const char *fmt, ...)
-{
- igb_t *igbp = (igb_t *)arg;
- char buf[LOG_BUF_LEN];
- va_list ap;
+ if (level > igb_debug)
+ return;
- va_start(ap, fmt);
- (void) vsnprintf(buf, sizeof (buf), fmt, ap);
- va_end(ap);
+ switch (level) {
+ case IGB_LOG_ERROR:
+ celevel = CE_WARN;
+ break;
+ case IGB_LOG_INFO:
+ celevel = CE_NOTE;
+ break;
+ case IGB_LOG_TRACE:
+ celevel = CE_CONT;
+ break;
+ default:
+ celevel = CE_IGNORE;
+ }
if (igbp != NULL)
- cmn_err(CE_WARN, "!%s%d: %s", MODULE_NAME, igbp->instance, buf);
+ dev_err(igbp->dip, celevel, "!%s", buf);
else
- cmn_err(CE_WARN, "!%s: %s", MODULE_NAME, buf);
+ cmn_err(celevel, "!%s", buf);
}
diff --git a/usr/src/uts/common/io/igb/igb_main.c b/usr/src/uts/common/io/igb/igb_main.c
index 23fad83ec6..a2f9622a85 100644
--- a/usr/src/uts/common/io/igb/igb_main.c
+++ b/usr/src/uts/common/io/igb/igb_main.c
@@ -472,7 +472,7 @@ igb_attach(dev_info_t *devinfo, ddi_attach_cmd_t cmd)
* Map PCI config space registers
*/
if (pci_config_setup(devinfo, &osdep->cfg_handle) != DDI_SUCCESS) {
- igb_error(igb, "Failed to map PCI configurations");
+ igb_log(igb, IGB_LOG_ERROR, "Failed to map PCI configurations");
goto attach_fail;
}
igb->attach_progress |= ATTACH_PROGRESS_PCI_CONFIG;
@@ -481,7 +481,7 @@ igb_attach(dev_info_t *devinfo, ddi_attach_cmd_t cmd)
* Identify the chipset family
*/
if (igb_identify_hardware(igb) != IGB_SUCCESS) {
- igb_error(igb, "Failed to identify hardware");
+ igb_log(igb, IGB_LOG_ERROR, "Failed to identify hardware");
goto attach_fail;
}
@@ -489,7 +489,7 @@ igb_attach(dev_info_t *devinfo, ddi_attach_cmd_t cmd)
* Map device registers
*/
if (igb_regs_map(igb) != IGB_SUCCESS) {
- igb_error(igb, "Failed to map device registers");
+ igb_log(igb, IGB_LOG_ERROR, "Failed to map device registers");
goto attach_fail;
}
igb->attach_progress |= ATTACH_PROGRESS_REGS_MAP;
@@ -504,7 +504,7 @@ igb_attach(dev_info_t *devinfo, ddi_attach_cmd_t cmd)
* Allocate interrupts
*/
if (igb_alloc_intrs(igb) != IGB_SUCCESS) {
- igb_error(igb, "Failed to allocate interrupts");
+ igb_log(igb, IGB_LOG_ERROR, "Failed to allocate interrupts");
goto attach_fail;
}
igb->attach_progress |= ATTACH_PROGRESS_ALLOC_INTR;
@@ -516,7 +516,8 @@ igb_attach(dev_info_t *devinfo, ddi_attach_cmd_t cmd)
* interrupts are allocated.
*/
if (igb_alloc_rings(igb) != IGB_SUCCESS) {
- igb_error(igb, "Failed to allocate rx/tx rings or groups");
+ igb_log(igb, IGB_LOG_ERROR,
+ "Failed to allocate rx/tx rings or groups");
goto attach_fail;
}
igb->attach_progress |= ATTACH_PROGRESS_ALLOC_RINGS;
@@ -525,7 +526,7 @@ igb_attach(dev_info_t *devinfo, ddi_attach_cmd_t cmd)
* Add interrupt handlers
*/
if (igb_add_intr_handlers(igb) != IGB_SUCCESS) {
- igb_error(igb, "Failed to add interrupt handlers");
+ igb_log(igb, IGB_LOG_ERROR, "Failed to add interrupt handlers");
goto attach_fail;
}
igb->attach_progress |= ATTACH_PROGRESS_ADD_INTR;
@@ -534,7 +535,8 @@ igb_attach(dev_info_t *devinfo, ddi_attach_cmd_t cmd)
* Initialize driver parameters
*/
if (igb_init_driver_settings(igb) != IGB_SUCCESS) {
- igb_error(igb, "Failed to initialize driver settings");
+ igb_log(igb, IGB_LOG_ERROR,
+ "Failed to initialize driver settings");
goto attach_fail;
}
@@ -556,7 +558,7 @@ igb_attach(dev_info_t *devinfo, ddi_attach_cmd_t cmd)
* Initialize the adapter
*/
if (igb_init(igb) != IGB_SUCCESS) {
- igb_error(igb, "Failed to initialize adapter");
+ igb_log(igb, IGB_LOG_ERROR, "Failed to initialize adapter");
goto attach_fail;
}
igb->attach_progress |= ATTACH_PROGRESS_INIT_ADAPTER;
@@ -565,7 +567,7 @@ igb_attach(dev_info_t *devinfo, ddi_attach_cmd_t cmd)
* Initialize statistics
*/
if (igb_init_stats(igb) != IGB_SUCCESS) {
- igb_error(igb, "Failed to initialize statistics");
+ igb_log(igb, IGB_LOG_ERROR, "Failed to initialize statistics");
goto attach_fail;
}
igb->attach_progress |= ATTACH_PROGRESS_STATS;
@@ -574,7 +576,7 @@ igb_attach(dev_info_t *devinfo, ddi_attach_cmd_t cmd)
* Register the driver to the MAC
*/
if (igb_register_mac(igb) != IGB_SUCCESS) {
- igb_error(igb, "Failed to register MAC");
+ igb_log(igb, IGB_LOG_ERROR, "Failed to register MAC");
goto attach_fail;
}
igb->attach_progress |= ATTACH_PROGRESS_MAC;
@@ -584,12 +586,12 @@ igb_attach(dev_info_t *devinfo, ddi_attach_cmd_t cmd)
* initialized, enable interrupts.
*/
if (igb_enable_intrs(igb) != IGB_SUCCESS) {
- igb_error(igb, "Failed to enable DDI interrupts");
+ igb_log(igb, IGB_LOG_ERROR, "Failed to enable DDI interrupts");
goto attach_fail;
}
igb->attach_progress |= ATTACH_PROGRESS_ENABLE_INTR;
- igb_log(igb, "%s", igb_version);
+ igb_log(igb, IGB_LOG_INFO, "%s", igb_version);
atomic_or_32(&igb->igb_state, IGB_INITIALIZED);
/*
@@ -654,7 +656,7 @@ igb_detach(dev_info_t *devinfo, ddi_detach_cmd_t cmd)
* Unregister MAC. If failed, we have to fail the detach
*/
if (mac_unregister(igb->mac_hdl) != 0) {
- igb_error(igb, "Failed to unregister MAC");
+ igb_log(igb, IGB_LOG_ERROR, "Failed to unregister MAC");
return (DDI_FAILURE);
}
igb->attach_progress &= ~ATTACH_PROGRESS_MAC;
@@ -1154,7 +1156,8 @@ igb_resume(dev_info_t *devinfo)
*/
if (igb->attach_progress & ATTACH_PROGRESS_ENABLE_INTR) {
if (igb_enable_intrs(igb) != IGB_SUCCESS) {
- igb_error(igb, "Failed to enable DDI interrupts");
+ igb_log(igb, IGB_LOG_ERROR,
+ "Failed to enable DDI interrupts");
mutex_exit(&igb->gen_lock);
return (DDI_FAILURE);
}
@@ -1261,7 +1264,7 @@ igb_init_mac_address(igb_t *igb)
* before we try to get MAC address from NVM.
*/
if (e1000_reset_hw(hw) != E1000_SUCCESS) {
- igb_error(igb, "Adapter reset failed.");
+ igb_log(igb, IGB_LOG_ERROR, "Adapter reset failed.");
goto init_mac_fail;
}
@@ -1277,7 +1280,7 @@ igb_init_mac_address(igb_t *igb)
* if it fails a second time its a real issue.
*/
if (e1000_validate_nvm_checksum(hw) < 0) {
- igb_error(igb,
+ igb_log(igb, IGB_LOG_ERROR,
"Invalid NVM checksum. Please contact "
"the vendor to update the NVM.");
goto init_mac_fail;
@@ -1289,13 +1292,13 @@ igb_init_mac_address(igb_t *igb)
* This function should handle SPARC case correctly.
*/
if (!igb_find_mac_address(igb)) {
- igb_error(igb, "Failed to get the mac address");
+ igb_log(igb, IGB_LOG_ERROR, "Failed to get the mac address");
goto init_mac_fail;
}
/* Validate mac address */
if (!is_valid_mac_addr(hw->mac.addr)) {
- igb_error(igb, "Invalid mac address");
+ igb_log(igb, IGB_LOG_ERROR, "Invalid mac address");
goto init_mac_fail;
}
@@ -1329,7 +1332,7 @@ igb_init_adapter(igb_t *igb)
* default settings come from.
*/
if (igb_init_mac_address(igb) != IGB_SUCCESS) {
- igb_error(igb, "Failed to initialize MAC address");
+ igb_log(igb, IGB_LOG_ERROR, "Failed to initialize MAC address");
goto init_adapter_fail;
}
@@ -1419,7 +1422,7 @@ igb_init_adapter(igb_t *igb)
* into effect.
*/
if (e1000_reset_hw(hw) != E1000_SUCCESS) {
- igb_error(igb, "Second reset failed");
+ igb_log(igb, IGB_LOG_ERROR, "Second reset failed");
goto init_adapter_fail;
}
@@ -1446,7 +1449,7 @@ igb_init_adapter(igb_t *igb)
* Configure/Initialize hardware
*/
if (e1000_init_hw(hw) != E1000_SUCCESS) {
- igb_error(igb, "Failed to initialize hardware");
+ igb_log(igb, IGB_LOG_ERROR, "Failed to initialize hardware");
goto init_adapter_fail;
}
@@ -1815,14 +1818,15 @@ igb_start(igb_t *igb, boolean_t alloc_buffer)
if (alloc_buffer) {
if (igb_alloc_rx_data(igb) != IGB_SUCCESS) {
- igb_error(igb,
+ igb_log(igb, IGB_LOG_ERROR,
"Failed to allocate software receive rings");
return (IGB_FAILURE);
}
/* Allocate buffers for all the rx/tx rings */
if (igb_alloc_dma(igb) != IGB_SUCCESS) {
- igb_error(igb, "Failed to allocate DMA resource");
+ igb_log(igb, IGB_LOG_ERROR,
+ "Failed to allocate DMA resource");
return (IGB_FAILURE);
}
@@ -2685,12 +2689,13 @@ igb_multicst_add(igb_t *igb, const uint8_t *multiaddr)
ASSERT(mutex_owned(&igb->gen_lock));
if ((multiaddr[0] & 01) == 0) {
- igb_error(igb, "Illegal multicast address");
+ igb_log(igb, IGB_LOG_ERROR, "Illegal multicast address");
return (EINVAL);
}
if (igb->mcast_count >= igb->mcast_max_num) {
- igb_error(igb, "Adapter requested more than %d mcast addresses",
+ igb_log(igb, IGB_LOG_ERROR,
+ "Adapter requested more than %d mcast addresses",
igb->mcast_max_num);
return (ENOENT);
}
@@ -2703,7 +2708,7 @@ igb_multicst_add(igb_t *igb, const uint8_t *multiaddr)
new_table = kmem_alloc(new_len, KM_NOSLEEP);
if (new_table == NULL) {
- igb_error(igb,
+ igb_log(igb, IGB_LOG_ERROR,
"Not enough memory to alloc mcast table");
return (ENOMEM);
}
@@ -2932,7 +2937,7 @@ igb_get_conf(igb_t *igb)
igb->num_rx_rings = 1;
if (igb->num_rx_groups > 1) {
- igb_error(igb,
+ igb_log(igb, IGB_LOG_ERROR,
"Invalid rx groups number. Please enable multiple "
"rings first");
igb->num_rx_groups = 1;
@@ -2947,7 +2952,7 @@ igb_get_conf(igb_t *igb)
break;
}
if (i != igb->num_rx_groups) {
- igb_error(igb,
+ igb_log(igb, IGB_LOG_ERROR,
"Invalid rx groups number. Downgrade the rx group "
"number to %d.", i);
igb->num_rx_groups = i;
@@ -3127,8 +3132,8 @@ igb_setup_link(igb_t *igb, boolean_t setup_hw)
}
if (invalid) {
- igb_notice(igb, "Invalid link settings. Setup link to "
- "autonegotiation with full link capabilities.");
+ igb_log(igb, IGB_LOG_INFO, "Invalid link settings. Setup "
+ "link to autonegotiation with full link capabilities.");
mac->autoneg = B_TRUE;
phy->autoneg_advertised = ADVERTISE_1000_FULL |
ADVERTISE_100_FULL | ADVERTISE_100_HALF |
@@ -3888,8 +3893,8 @@ igb_set_loopback_mode(igb_t *igb, uint32_t mode)
(void) igb_reset(igb);
hw->phy.autoneg_wait_to_complete = B_FALSE;
- IGB_DEBUGLOG_0(igb, "Set external loopback failed, "
- "reset to loopback none.");
+ igb_log(igb, IGB_LOG_INFO, "Set external loopback "
+ "failed, reset to loopback none.");
return (B_FALSE);
}
@@ -4345,11 +4350,12 @@ igb_alloc_intrs(igb_t *igb)
rc = ddi_intr_get_supported_types(devinfo, &intr_types);
if (rc != DDI_SUCCESS) {
- igb_log(igb,
+ igb_log(igb, IGB_LOG_ERROR,
"Get supported interrupt types failed: %d", rc);
return (IGB_FAILURE);
}
- IGB_DEBUGLOG_1(igb, "Supported interrupt types: %x", intr_types);
+ igb_log(igb, IGB_LOG_INFO, "Supported interrupt types: %x",
+ intr_types);
igb->intr_type = 0;
@@ -4361,14 +4367,14 @@ igb_alloc_intrs(igb_t *igb)
if (rc == IGB_SUCCESS)
return (IGB_SUCCESS);
- igb_log(igb,
+ igb_log(igb, IGB_LOG_INFO,
"Allocate MSI-X failed, trying MSI interrupts...");
}
/* MSI-X not used, force rings to 1 */
igb->num_rx_rings = 1;
igb->num_tx_rings = 1;
- igb_log(igb,
+ igb_log(igb, IGB_LOG_INFO,
"MSI-X not used, force rx and tx queue number to 1");
/* Install MSI interrupts */
@@ -4379,7 +4385,7 @@ igb_alloc_intrs(igb_t *igb)
if (rc == IGB_SUCCESS)
return (IGB_SUCCESS);
- igb_log(igb,
+ igb_log(igb, IGB_LOG_INFO,
"Allocate MSI failed, trying Legacy interrupts...");
}
@@ -4390,7 +4396,7 @@ igb_alloc_intrs(igb_t *igb)
if (rc == IGB_SUCCESS)
return (IGB_SUCCESS);
- igb_log(igb,
+ igb_log(igb, IGB_LOG_INFO,
"Allocate Legacy interrupts failed");
}
@@ -4420,13 +4426,13 @@ igb_alloc_intr_handles(igb_t *igb, int intr_type)
case DDI_INTR_TYPE_FIXED:
request = 1; /* Request 1 legacy interrupt handle */
minimum = 1;
- IGB_DEBUGLOG_0(igb, "interrupt type: legacy");
+ igb_log(igb, IGB_LOG_INFO, "interrupt type: legacy");
break;
case DDI_INTR_TYPE_MSI:
request = 1; /* Request 1 MSI interrupt handle */
minimum = 1;
- IGB_DEBUGLOG_0(igb, "interrupt type: MSI");
+ igb_log(igb, IGB_LOG_INFO, "interrupt type: MSI");
break;
case DDI_INTR_TYPE_MSIX:
@@ -4438,16 +4444,17 @@ igb_alloc_intr_handles(igb_t *igb, int intr_type)
request = igb->num_rx_rings + igb->num_tx_rings;
orig = request;
minimum = 2;
- IGB_DEBUGLOG_0(igb, "interrupt type: MSI-X");
+ igb_log(igb, IGB_LOG_INFO, "interrupt type: MSI-X");
break;
default:
- igb_log(igb,
+ igb_log(igb, IGB_LOG_INFO,
"invalid call to igb_alloc_intr_handles(): %d\n",
intr_type);
return (IGB_FAILURE);
}
- IGB_DEBUGLOG_2(igb, "interrupt handles requested: %d minimum: %d",
+ igb_log(igb, IGB_LOG_INFO,
+ "interrupt handles requested: %d minimum: %d",
request, minimum);
/*
@@ -4455,27 +4462,28 @@ igb_alloc_intr_handles(igb_t *igb, int intr_type)
*/
rc = ddi_intr_get_nintrs(devinfo, intr_type, &count);
if ((rc != DDI_SUCCESS) || (count < minimum)) {
- igb_log(igb,
+ igb_log(igb, IGB_LOG_INFO,
"Get supported interrupt number failed. "
"Return: %d, count: %d", rc, count);
return (IGB_FAILURE);
}
- IGB_DEBUGLOG_1(igb, "interrupts supported: %d", count);
+ igb_log(igb, IGB_LOG_INFO, "interrupts supported: %d", count);
/*
* Get number of available interrupts
*/
rc = ddi_intr_get_navail(devinfo, intr_type, &avail);
if ((rc != DDI_SUCCESS) || (avail < minimum)) {
- igb_log(igb,
+ igb_log(igb, IGB_LOG_INFO,
"Get available interrupt number failed. "
"Return: %d, available: %d", rc, avail);
return (IGB_FAILURE);
}
- IGB_DEBUGLOG_1(igb, "interrupts available: %d", avail);
+ igb_log(igb, IGB_LOG_INFO, "interrupts available: %d", avail);
if (avail < request) {
- igb_log(igb, "Request %d handles, %d available",
+ igb_log(igb, IGB_LOG_INFO,
+ "Request %d handles, %d available",
request, avail);
request = avail;
}
@@ -4492,17 +4500,18 @@ igb_alloc_intr_handles(igb_t *igb, int intr_type)
rc = ddi_intr_alloc(devinfo, igb->htable, intr_type, 0,
request, &actual, DDI_INTR_ALLOC_NORMAL);
if (rc != DDI_SUCCESS) {
- igb_log(igb, "Allocate interrupts failed. "
+ igb_log(igb, IGB_LOG_INFO, "Allocate interrupts failed. "
"return: %d, request: %d, actual: %d",
rc, request, actual);
goto alloc_handle_fail;
}
- IGB_DEBUGLOG_1(igb, "interrupts actually allocated: %d", actual);
+ igb_log(igb, IGB_LOG_INFO, "interrupts actually allocated: %d", actual);
igb->intr_cnt = actual;
if (actual < minimum) {
- igb_log(igb, "Insufficient interrupt handles allocated: %d",
+ igb_log(igb, IGB_LOG_INFO,
+ "Insufficient interrupt handles allocated: %d",
actual);
goto alloc_handle_fail;
}
@@ -4513,16 +4522,16 @@ igb_alloc_intr_handles(igb_t *igb, int intr_type)
if ((intr_type == DDI_INTR_TYPE_MSIX) && (orig > actual)) {
diff = orig - actual;
if (diff < igb->num_tx_rings) {
- igb_log(igb,
+ igb_log(igb, IGB_LOG_INFO,
"MSI-X vectors force Tx queue number to %d",
igb->num_tx_rings - diff);
igb->num_tx_rings -= diff;
} else {
- igb_log(igb,
+ igb_log(igb, IGB_LOG_INFO,
"MSI-X vectors force Tx queue number to 1");
igb->num_tx_rings = 1;
- igb_log(igb,
+ igb_log(igb, IGB_LOG_INFO,
"MSI-X vectors force Rx queue number to %d",
actual - 1);
igb->num_rx_rings = actual - 1;
@@ -4534,14 +4543,14 @@ igb_alloc_intr_handles(igb_t *igb, int intr_type)
*/
rc = ddi_intr_get_pri(igb->htable[0], &igb->intr_pri);
if (rc != DDI_SUCCESS) {
- igb_log(igb,
+ igb_log(igb, IGB_LOG_INFO,
"Get interrupt priority failed: %d", rc);
goto alloc_handle_fail;
}
rc = ddi_intr_get_cap(igb->htable[0], &igb->intr_cap);
if (rc != DDI_SUCCESS) {
- igb_log(igb,
+ igb_log(igb, IGB_LOG_INFO,
"Get interrupt cap failed: %d", rc);
goto alloc_handle_fail;
}
@@ -4582,7 +4591,7 @@ igb_add_intr_handlers(igb_t *igb)
(void *)igb, NULL);
if (rc != DDI_SUCCESS) {
- igb_log(igb,
+ igb_log(igb, IGB_LOG_INFO,
"Add tx/other interrupt handler failed: %d", rc);
return (IGB_FAILURE);
}
@@ -4598,7 +4607,7 @@ igb_add_intr_handlers(igb_t *igb)
(void *)rx_ring, NULL);
if (rc != DDI_SUCCESS) {
- igb_log(igb,
+ igb_log(igb, IGB_LOG_INFO,
"Add rx interrupt handler failed. "
"return: %d, rx ring: %d", rc, i);
for (vector--; vector >= 0; vector--) {
@@ -4622,7 +4631,7 @@ igb_add_intr_handlers(igb_t *igb)
(void *)tx_ring, NULL);
if (rc != DDI_SUCCESS) {
- igb_log(igb,
+ igb_log(igb, IGB_LOG_INFO,
"Add tx interrupt handler failed. "
"return: %d, tx ring: %d", rc, i);
for (vector--; vector >= 0; vector--) {
@@ -4646,7 +4655,7 @@ igb_add_intr_handlers(igb_t *igb)
(void *)igb, NULL);
if (rc != DDI_SUCCESS) {
- igb_log(igb,
+ igb_log(igb, IGB_LOG_INFO,
"Add MSI interrupt handler failed: %d", rc);
return (IGB_FAILURE);
}
@@ -4664,7 +4673,7 @@ igb_add_intr_handlers(igb_t *igb)
(void *)igb, NULL);
if (rc != DDI_SUCCESS) {
- igb_log(igb,
+ igb_log(igb, IGB_LOG_INFO,
"Add legacy interrupt handler failed: %d", rc);
return (IGB_FAILURE);
}
@@ -4941,7 +4950,7 @@ igb_rem_intr_handlers(igb_t *igb)
for (i = 0; i < igb->intr_cnt; i++) {
rc = ddi_intr_remove_handler(igb->htable[i]);
if (rc != DDI_SUCCESS) {
- IGB_DEBUGLOG_1(igb,
+ igb_log(igb, IGB_LOG_INFO,
"Remove intr handler failed: %d", rc);
}
}
@@ -4959,7 +4968,7 @@ igb_rem_intrs(igb_t *igb)
for (i = 0; i < igb->intr_cnt; i++) {
rc = ddi_intr_free(igb->htable[i]);
if (rc != DDI_SUCCESS) {
- IGB_DEBUGLOG_1(igb,
+ igb_log(igb, IGB_LOG_INFO,
"Free intr failed: %d", rc);
}
}
@@ -4982,7 +4991,7 @@ igb_enable_intrs(igb_t *igb)
/* Call ddi_intr_block_enable() for MSI */
rc = ddi_intr_block_enable(igb->htable, igb->intr_cnt);
if (rc != DDI_SUCCESS) {
- igb_log(igb,
+ igb_log(igb, IGB_LOG_ERROR,
"Enable block intr failed: %d", rc);
return (IGB_FAILURE);
}
@@ -4991,7 +5000,7 @@ igb_enable_intrs(igb_t *igb)
for (i = 0; i < igb->intr_cnt; i++) {
rc = ddi_intr_enable(igb->htable[i]);
if (rc != DDI_SUCCESS) {
- igb_log(igb,
+ igb_log(igb, IGB_LOG_ERROR,
"Enable intr failed: %d", rc);
return (IGB_FAILURE);
}
@@ -5014,7 +5023,7 @@ igb_disable_intrs(igb_t *igb)
if (igb->intr_cap & DDI_INTR_FLAG_BLOCK) {
rc = ddi_intr_block_disable(igb->htable, igb->intr_cnt);
if (rc != DDI_SUCCESS) {
- igb_log(igb,
+ igb_log(igb, IGB_LOG_ERROR,
"Disable block intr failed: %d", rc);
return (IGB_FAILURE);
}
@@ -5022,7 +5031,7 @@ igb_disable_intrs(igb_t *igb)
for (i = 0; i < igb->intr_cnt; i++) {
rc = ddi_intr_disable(igb->htable[i]);
if (rc != DDI_SUCCESS) {
- igb_log(igb,
+ igb_log(igb, IGB_LOG_ERROR,
"Disable intr failed: %d", rc);
return (IGB_FAILURE);
}
diff --git a/usr/src/uts/common/io/igb/igb_rx.c b/usr/src/uts/common/io/igb/igb_rx.c
index 3f7ac957a5..df64d128f7 100644
--- a/usr/src/uts/common/io/igb/igb_rx.c
+++ b/usr/src/uts/common/io/igb/igb_rx.c
@@ -157,7 +157,8 @@ igb_rx_copy(igb_rx_data_t *rx_data, uint32_t index, uint32_t pkt_len)
*/
mp = allocb(pkt_len + IPHDR_ALIGN_ROOM, 0);
if (mp == NULL) {
- igb_log(igb, "igb_rx_copy: allocate buffer failed");
+ igb_log(igb, IGB_LOG_INFO,
+ "igb_rx_copy: allocate buffer failed");
return (NULL);
}
diff --git a/usr/src/uts/common/io/igb/igb_stat.c b/usr/src/uts/common/io/igb/igb_stat.c
index 7d0e41136d..5674768010 100644
--- a/usr/src/uts/common/io/igb/igb_stat.c
+++ b/usr/src/uts/common/io/igb/igb_stat.c
@@ -161,7 +161,7 @@ igb_init_stats(igb_t *igb)
sizeof (igb_stat_t) / sizeof (kstat_named_t), 0);
if (ks == NULL) {
- igb_error(igb,
+ igb_log(igb, IGB_LOG_ERROR,
"Could not create kernel statistics");
return (IGB_FAILURE);
}
diff --git a/usr/src/uts/common/io/igb/igb_sw.h b/usr/src/uts/common/io/igb/igb_sw.h
index 6793f21ffe..e6a0f6c277 100644
--- a/usr/src/uts/common/io/igb/igb_sw.h
+++ b/usr/src/uts/common/io/igb/igb_sw.h
@@ -856,13 +856,6 @@ uint32_t igb_tx_recycle_legacy(igb_tx_ring_t *);
uint32_t igb_tx_recycle_head_wb(igb_tx_ring_t *);
/*
- * Function prototypes in igb_log.c
- */
-void igb_notice(void *, const char *, ...);
-void igb_log(void *, const char *, ...);
-void igb_error(void *, const char *, ...);
-
-/*
* Function prototypes in igb_stat.c
*/
int igb_init_stats(igb_t *);
diff --git a/usr/src/uts/common/io/igb/igb_tx.c b/usr/src/uts/common/io/igb/igb_tx.c
index 7a72b2ece7..0a23288a01 100644
--- a/usr/src/uts/common/io/igb/igb_tx.c
+++ b/usr/src/uts/common/io/igb/igb_tx.c
@@ -146,14 +146,14 @@ igb_tx(igb_tx_ring_t *tx_ring, mblk_t *mp)
(!ctx->lso_flag &&
(mbsize > (igb->max_frame_size - ETHERFCSL)))) {
freemsg(mp);
- IGB_DEBUGLOG_0(igb, "igb_tx: packet oversize");
+ igb_log(igb, IGB_LOG_INFO, "igb_tx: packet oversize");
return (B_TRUE);
}
} else {
ctx = NULL;
if (mbsize > (igb->max_frame_size - ETHERFCSL)) {
freemsg(mp);
- IGB_DEBUGLOG_0(igb, "igb_tx: packet oversize");
+ igb_log(igb, IGB_LOG_INFO, "igb_tx: packet oversize");
return (B_TRUE);
}
}
@@ -629,7 +629,7 @@ igb_get_tx_context(mblk_t *mp, tx_context_t *ctx)
if (ctx->lso_flag) {
if (!((ctx->hcksum_flags & HCK_PARTIALCKSUM) &&
(ctx->hcksum_flags & HCK_IPV4_HDRCKSUM))) {
- IGB_DEBUGLOG_0(NULL, "igb_tx: h/w "
+ igb_log(NULL, IGB_LOG_INFO, "igb_tx: h/w "
"checksum flags are not set for LSO");
return (TX_CXT_E_LSO_CSUM);
}
@@ -721,7 +721,7 @@ igb_get_tx_context(mblk_t *mp, tx_context_t *ctx)
break;
default:
/* Unrecoverable error */
- IGB_DEBUGLOG_0(NULL, "Ethernet type field error with "
+ igb_log(NULL, IGB_LOG_INFO, "Ethernet type field error with "
"tx hcksum flag set");
return (TX_CXT_E_ETHER_TYPE);
}
@@ -832,7 +832,8 @@ igb_fill_tx_context(struct e1000_adv_tx_context_desc *ctx_tbd,
break;
default:
/* Unrecoverable error */
- IGB_DEBUGLOG_0(NULL, "L4 type error with tx hcksum");
+ igb_log(NULL, IGB_LOG_INFO,
+ "L4 type error with tx hcksum");
break;
}
}