drivers/net conversions to netdev_<level>, etc
Subsystems (2)
cover drivers/net conversions to netdev_<level>, etc
Some more conversions of drivers to:
netif_<level>
netdev_<level>
pr_<level>with some other minor updates/corrections
noticed during conversions.
Joe Perches (7):
drivers/net/chelsio: Use pr_<level>, netif_msg_<type> drivers/net/myri10ge: Use pr_<level> and netdev_<level> drivers/net/ixgbe: Use pr_<level> and netif_<level> drivers/net/ixgb: Use pr_<level> and netdev_<level> drivers/net/e1000: Use pr_<level> and netif_<level> drivers/net/e1000e: Use pr_<level> and netdev_<level> drivers/net/igb: Use netdev_<level>
drivers/net/chelsio/common.h | 24 +-- drivers/net/chelsio/cxgb2.c | 18 +- drivers/net/chelsio/espi.c | 4 +- drivers/net/chelsio/pm3393.c | 16 +- drivers/net/chelsio/sge.c | 10 +- drivers/net/chelsio/subr.c | 32 ++-- drivers/net/chelsio/vsc7326.c | 24 ++-- drivers/net/e1000/e1000.h | 17 -- drivers/net/e1000/e1000_ethtool.c | 38 ++-- drivers/net/e1000/e1000_hw.c | 383 ++++++++++++++++++------------------- drivers/net/e1000/e1000_main.c | 272 +++++++++++++------------- drivers/net/e1000/e1000_osdep.h | 14 +-- drivers/net/e1000/e1000_param.c | 121 +++++++------ drivers/net/e1000e/82571.c | 57 ++++-- drivers/net/e1000e/e1000.h | 21 -- drivers/net/e1000e/es2lan.c | 27 ++-- drivers/net/e1000e/ethtool.c | 37 ++-- drivers/net/e1000e/ich8lan.c | 90 +++++---- drivers/net/e1000e/lib.c | 131 +++++++------- drivers/net/e1000e/netdev.c | 95 +++++----- drivers/net/e1000e/param.c | 20 +- drivers/net/e1000e/phy.c | 114 ++++++------ drivers/net/igb/e1000_82575.c | 58 +++--- drivers/net/igb/e1000_hw.h | 12 +- drivers/net/igb/e1000_mac.c | 84 ++++---- drivers/net/igb/e1000_nvm.c | 22 +- drivers/net/igb/e1000_phy.c | 104 +++++----- drivers/net/igb/igb.h | 1 - drivers/net/igb/igb_ethtool.c | 6 +- drivers/net/igb/igb_main.c | 43 ++--- drivers/net/ixgb/ixgb.h | 8 +- drivers/net/ixgb/ixgb_ee.c | 14 +- drivers/net/ixgb/ixgb_hw.c | 147 ++++++--------- drivers/net/ixgb/ixgb_hw.h | 12 -- drivers/net/ixgb/ixgb_main.c | 33 ++-- drivers/net/ixgb/ixgb_osdep.h | 16 +-- drivers/net/ixgb/ixgb_param.c | 31 ++-- drivers/net/ixgbe/ixgbe.h | 6 - drivers/net/ixgbe/ixgbe_common.h | 15 +- drivers/net/ixgbe/ixgbe_dcb_nl.c | 5 +- drivers/net/ixgbe/ixgbe_ethtool.c | 40 +++-- drivers/net/ixgbe/ixgbe_fcoe.c | 25 ++-- drivers/net/ixgbe/ixgbe_main.c | 110 +++++------ drivers/net/ixgbe/ixgbe_phy.c | 2 + drivers/net/ixgbe/ixgbe_sriov.c | 11 +- drivers/net/myri10ge/myri10ge.c | 183 +++++++----------- 46 files changed, 1202 insertions(+), 1351 deletions(-)
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
E1000-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/e1000-devel
To learn more about Intel® Ethernet, visit http://communities.intel.com/community/wired
PATCH 1/7 drivers/net/chelsio: Use pr_<level>, netif_msg_<type>
Convert CH_<level> and CH_DBG uses to pr_<level> and netif equivalents Remove CH_<level> and CH_DBG macro definitions
--- drivers/net/chelsio/common.h | 24 ++---------------------- drivers/net/chelsio/cxgb2.c | 18 +++++++++--------- drivers/net/chelsio/espi.c | 4 ++-- drivers/net/chelsio/pm3393.c | 16 +++++++++------- drivers/net/chelsio/sge.c | 10 +++++----- drivers/net/chelsio/subr.c | 32 +++++++++++++++++--------------- drivers/net/chelsio/vsc7326.c | 24 ++++++++++++------------ 7 files changed, 56 insertions(+), 72 deletions(-)
drivers/net/chelsio/common.h +2 -22
@@ -36,6 +36,8 @@* * ****************************************************************************/ +#define pr_fmt (fmt) "cxgb: " fmt +#ifndef _CXGB_COMMON_H_#define _CXGB_COMMON_H_
@@ -55,28 +57,6 @@#define DRV_DESCRIPTION "Chelsio 10Gb Ethernet Driver"#define DRV_NAME "cxgb"#define DRV_VERSION "2.2" -#define PFX DRV_NAME ": " - -#define CH_ERR (fmt, ...) printk(KERN_ERR PFX fmt, ## __VA_ARGS__) -#define CH_WARN (fmt, ...) printk(KERN_WARNING PFX fmt, ## __VA_ARGS__) -#define CH_ALERT (fmt, ...) printk(KERN_ALERT PFX fmt, ## __VA_ARGS__) - -/* -* More powerful macro that selectively prints messages based on msg_enable. -* For info and debugging messages. -*/ -#define CH_MSG (adapter, level, category, fmt, ...) do { \ - if ((adapter)->msg_enable & NETIF_MSG_##category) \ - printk(KERN_##level PFX "%s: " fmt, (adapter)->name, \ - ## __VA_ARGS__); \ -} while (0) - -#ifdef DEBUG -# define CH_DBG (adapter, category, fmt, ...) \ - CH_MSG(adapter, DEBUG, category, fmt, ## __VA_ARGS__) -#else -# define CH_DBG (fmt, ...) -#endif #define CH_DEVICE (devid, ssid, idx) \ { PCI_VENDOR_ID_CHELSIO, devid, PCI_ANY_ID, ssid, 0, 0, idx }
drivers/net/chelsio/cxgb2.c +9 -9
@@ -974,7 +974,7 @@ void t1_fatal_err(struct adapter *adapter)t1_sge_stop (adapter->sge);t1_interrupts_disable (adapter); } -CH_ALERT ("%s: encountered fatal error, operation suspended\n" , +pr_alert ("%s: encountered fatal error, operation suspended\n" , adapter->name); }
@@ -1018,7 +1018,7 @@ static int __devinit init_one(struct pci_dev *pdev,return err;if (!(pci_resource_flags (pdev,0 ) &IORESOURCE_MEM )) { -CH_ERR ("%s: cannot find PCI device memory base address\n" , +pr_err ("%s: cannot find PCI device memory base address\n" ,pci_name (pdev)); err = -ENODEV ; goto out_disable_pdev;
@@ -1028,20 +1028,20 @@ static int __devinit init_one(struct pci_dev *pdev, pci_using_dac =1 ;if (pci_set_consistent_dma_mask (pdev,DMA_BIT_MASK (64 ))) { -CH_ERR ("%s: unable to obtain 64-bit DMA for " +pr_err ("%s: unable to obtain 64-bit DMA for " "consistent allocations\n" ,pci_name (pdev)); err = -ENODEV ; goto out_disable_pdev; } }else if ((err =pci_set_dma_mask (pdev,DMA_BIT_MASK (32 ))) !=0 ) { -CH_ERR ("%s: no usable DMA configuration\n" ,pci_name (pdev)); +pr_err ("%s: no usable DMA configuration\n" ,pci_name (pdev)); goto out_disable_pdev; } err =pci_request_regions (pdev,DRV_NAME );if (err) { -CH_ERR ("%s: cannot obtain PCI resources\n" ,pci_name (pdev)); +pr_err ("%s: cannot obtain PCI resources\n" ,pci_name (pdev)); goto out_disable_pdev; }
@@ -1069,7 +1069,7 @@ static int __devinit init_one(struct pci_dev *pdev, adapter->regs =ioremap (mmio_start, mmio_len);if (!adapter->regs) { -CH_ERR ("%s: cannot map device registers\n" , +pr_err ("%s: cannot map device registers\n" ,pci_name (pdev)); err = -ENOMEM ; goto out_free_dev;
@@ -1148,8 +1148,8 @@ static int __devinit init_one(struct pci_dev *pdev,for (i =0 ; i < bi->port_number; ++i) { err =register_netdev (adapter->port[i].dev);if (err) -CH_WARN ("%s: cannot register net device %s, skipping\n" , -pci_name (pdev), adapter->port[i].dev->name); +pr_warning ("%s: cannot register net device %s, skipping\n" , +pci_name (pdev), adapter->port[i].dev->name);else {/* * Change the name we use for messages to the name of
@@ -1162,7 +1162,7 @@ static int __devinit init_one(struct pci_dev *pdev, } }if (!adapter->registered_device_map) { -CH_ERR ("%s: could not register any net devices\n" , +pr_err ("%s: could not register any net devices\n" ,pci_name (pdev)); goto out_release_adapter_res; }
drivers/net/chelsio/espi.c +2 -2
@@ -76,7 +76,7 @@ static int tricn_write(adapter_t *adapter, int bundle_addr, int module_addr, }while (busy && --attempts);if (busy) -CH_ERR ("%s: TRICN write timed out\n" , adapter->name); +pr_err ("%s: TRICN write timed out\n" , adapter->name);return busy; }
@@ -86,7 +86,7 @@ static int tricn_init(adapter_t *adapter)int i, sme =1 ;if (!(readl (adapter->regs +A_ESPI_RX_RESET ) &F_RX_CLK_STATUS )) { -CH_ERR ("%s: ESPI clock not ready\n" , adapter->name); +pr_err ("%s: ESPI clock not ready\n" , adapter->name);return -1 ; }
drivers/net/chelsio/pm3393.c +9 -7
@@ -251,8 +251,9 @@ static int pm3393_interrupt_handler(struct cmac *cmac)/* Read the master interrupt status register. */ pmread (cmac, SUNI1x10GEXP_REG_MASTER_INTERRUPT_STATUS, &master_intr_status); -CH_DBG (cmac->adapter,INTR ,"PM3393 intr cause 0x%x\n" , - master_intr_status); +if (netif_msg_intr (cmac->adapter)) +dev_dbg (&cmac->adapter->pdev->dev,"PM3393 intr cause 0x%x\n" , + master_intr_status);/* TBD XXX Lets just clear everything for now */ pm3393_interrupt_clear (cmac);
@@ -776,11 +777,12 @@ static int pm3393_mac_reset(adapter_t * adapter) successful_reset = (is_pl4_reset_finished && !is_pl4_outof_lock && is_xaui_mabc_pll_locked); -CH_DBG (adapter,HW , -"PM3393 HW reset %d: pl4_reset 0x%x, val 0x%x, " -"is_pl4_outof_lock 0x%x, xaui_locked 0x%x\n" , - i, is_pl4_reset_finished, val, is_pl4_outof_lock, - is_xaui_mabc_pll_locked); +if (netif_msg_hw (adapter)) +dev_dbg (&adapter->pdev->dev, +"PM3393 HW reset %d: pl4_reset 0x%x, val 0x%x, " +"is_pl4_outof_lock 0x%x, xaui_locked 0x%x\n" , + i, is_pl4_reset_finished, val, + is_pl4_outof_lock, is_xaui_mabc_pll_locked); }return successful_reset ?0 :1 ; }
drivers/net/chelsio/sge.c +5 -5
@@ -953,7 +953,7 @@ int t1_sge_intr_error_handler(struct sge *sge) sge->stats.respQ_empty++;if (cause &F_RESPQ_OVERFLOW ) { sge->stats.respQ_overflow++; -CH_ALERT ("%s: SGE response queue overflow\n" , +pr_alert ("%s: SGE response queue overflow\n" , adapter->name); }if (cause &F_FL_EXHAUSTED ) {
@@ -962,12 +962,12 @@ int t1_sge_intr_error_handler(struct sge *sge) }if (cause &F_PACKET_TOO_BIG ) { sge->stats.pkt_too_big++; -CH_ALERT ("%s: SGE max packet size exceeded\n" , +pr_alert ("%s: SGE max packet size exceeded\n" , adapter->name); }if (cause &F_PACKET_MISMATCH ) { sge->stats.pkt_mismatch++; -CH_ALERT ("%s: SGE packet mismatch\n" , adapter->name); +pr_alert ("%s: SGE packet mismatch\n" , adapter->name); }if (cause &SGE_INT_FATAL )t1_fatal_err (adapter);
@@ -1101,7 +1101,7 @@ static void unexpected_offload(struct adapter *adapter, struct freelQ *fl)pci_dma_sync_single_for_cpu (adapter->pdev,pci_unmap_addr (ce, dma_addr),pci_unmap_len (ce, dma_len),PCI_DMA_FROMDEVICE ); -CH_ERR ("%s: unexpected offload packet, cmd %u\n" , +pr_err ("%s: unexpected offload packet, cmd %u\n" , adapter->name, *skb->data);recycle_fl_buf (fl, fl->cidx); }
@@ -1687,7 +1687,7 @@ static int t1_sge_tx(struct sk_buff *skb, struct adapter *adapter,netif_stop_queue (dev);set_bit (dev->if_port, &sge->stopped_tx_queues); sge->stats.cmdQ_full[2 ]++; -CH_ERR ("%s: Tx ring full while queue awake!\n" , +pr_err ("%s: Tx ring full while queue awake!\n" , adapter->name); }spin_unlock (&q->lock);
drivers/net/chelsio/subr.c +17 -15
@@ -90,7 +90,7 @@ int __t1_tpi_write(adapter_t *adapter, u32 addr, u32 value) tpi_busy =t1_wait_op_done (adapter,A_TPI_CSR ,F_TPIRDY ,1 ,TPI_ATTEMPTS ,3 );if (tpi_busy) -CH_ALERT ("%s: TPI write to 0x%x failed\n" , +pr_alert ("%s: TPI write to 0x%x failed\n" , adapter->name, addr);return tpi_busy; }
@@ -118,7 +118,7 @@ int __t1_tpi_read(adapter_t *adapter, u32 addr, u32 *valp) tpi_busy =t1_wait_op_done (adapter,A_TPI_CSR ,F_TPIRDY ,1 ,TPI_ATTEMPTS ,3 );if (tpi_busy) -CH_ALERT ("%s: TPI read from 0x%x failed\n" , +pr_alert ("%s: TPI read from 0x%x failed\n" , adapter->name, addr);else *valp =readl (adapter->regs +A_TPI_RD_DATA );
@@ -262,7 +262,7 @@ static int mi1_wait_until_ready(adapter_t *adapter, int mi1_reg)udelay (10 ); }while (busy && --attempts);if (busy) -CH_ALERT ("%s: MDIO operation timed out\n" , adapter->name); +pr_alert ("%s: MDIO operation timed out\n" , adapter->name);return busy; }
@@ -581,7 +581,7 @@ int t1_seeprom_read(adapter_t *adapter, u32 addr, __le32 *data) }while (!(val &F_VPD_OP_FLAG ) && --i);if (!(val &F_VPD_OP_FLAG )) { -CH_ERR ("%s: reading EEPROM address 0x%x failed\n" , +pr_err ("%s: reading EEPROM address 0x%x failed\n" , adapter->name, addr);return -EIO ; }
@@ -734,8 +734,9 @@ int t1_elmer0_ext_intr_handler(adapter_t *adapter)break ;case CHBT_BOARD_8000 :case CHBT_BOARD_CHT110 : -CH_DBG (adapter,INTR ,"External interrupt cause 0x%x\n" , - cause); +if (netif_msg_intr (adapter)) +dev_dbg (&adapter->pdev->dev, +"External interrupt cause 0x%x\n" , cause);if (cause &ELMER0_GP_BIT1 ) {/* PMC3393 INTB */ struct cmac *mac = adapter->port[0 ].mac;
@@ -746,8 +747,9 @@ int t1_elmer0_ext_intr_handler(adapter_t *adapter)t1_tpi_read (adapter,A_ELMER0_GPI_STAT , &mod_detect); -CH_MSG (adapter,INFO ,LINK ,"XPAK %s\n" , - mod_detect ?"removed" :"inserted" ); +if (netif_msg_link (adapter)) +dev_info (&adapter->pdev->dev,"XPAK %s\n" , + mod_detect ?"removed" :"inserted" ); }break ;#ifdef CONFIG_CHELSIO_T1_COUGAR
@@ -1084,7 +1086,7 @@ static void __devinit init_link_config(struct link_config *lc,#ifdef CONFIG_CHELSIO_T1_COUGAR if (bi->clock_cspi && !(adapter->cspi =t1_cspi_create (adapter))) { -CH_ERR ("%s: CSPI initialization failed\n" , +pr_err ("%s: CSPI initialization failed\n" , adapter->name); goto error; }
@@ -1105,20 +1107,20 @@ int __devinit t1_init_sw_modules(adapter_t *adapter, adapter->sge =t1_sge_create (adapter, &adapter->params.sge);if (!adapter->sge) { -CH_ERR ("%s: SGE initialization failed\n" , +pr_err ("%s: SGE initialization failed\n" , adapter->name); goto error; }if (bi->espi_nports && !(adapter->espi =t1_espi_create (adapter))) { -CH_ERR ("%s: ESPI initialization failed\n" , +pr_err ("%s: ESPI initialization failed\n" , adapter->name); goto error; } adapter->tp =t1_tp_create (adapter, &adapter->params.tp);if (!adapter->tp) { -CH_ERR ("%s: TP initialization failed\n" , +pr_err ("%s: TP initialization failed\n" , adapter->name); goto error; }
@@ -1138,14 +1140,14 @@ int __devinit t1_init_sw_modules(adapter_t *adapter, adapter->port[i].phy = bi->gphy->create (adapter->port[i].dev, phy_addr, bi->mdio_ops);if (!adapter->port[i].phy) { -CH_ERR ("%s: PHY %d initialization failed\n" , +pr_err ("%s: PHY %d initialization failed\n" , adapter->name, i); goto error; } adapter->port[i].mac = mac = bi->gmac->create (adapter, i);if (!mac) { -CH_ERR ("%s: MAC %d initialization failed\n" , +pr_err ("%s: MAC %d initialization failed\n" , adapter->name, i); goto error; }
@@ -1157,7 +1159,7 @@ int __devinit t1_init_sw_modules(adapter_t *adapter,if (!t1_is_asic (adapter) || bi->chip_mac ==CHBT_MAC_DUMMY ) mac->ops->macaddress_get (mac, hw_addr);else if (vpd_macaddress_get (adapter, i, hw_addr)) { -CH_ERR ("%s: could not read MAC address from VPD ROM\n" , +pr_err ("%s: could not read MAC address from VPD ROM\n" , adapter->port[i].dev->name); goto error; }
drivers/net/chelsio/vsc7326.c +12 -12
@@ -48,14 +48,14 @@ static void vsc_read(adapter_t *adapter, u32 addr, u32 *val) i++; }while (((status &1 ) ==0 ) && (i <50 ));if (i ==50 ) -CH_ERR ("Invalid tpi read from MAC, breaking loop.\n" ); +pr_err ("Invalid tpi read from MAC, breaking loop.\n" );t1_tpi_read (adapter, (REG_LOCAL_DATA <<2 ) +4 , &vlo);t1_tpi_read (adapter,REG_LOCAL_DATA <<2 , &vhi); *val = (vhi <<16 ) | vlo; -/* CH_ERR("rd: block: 0x%x sublock: 0x%x reg: 0x%x data: 0x%x\n", +/* pr_err("rd: block: 0x%x sublock: 0x%x reg: 0x%x data: 0x%x\n", ((addr&0xe000)>>13), ((addr&0x1e00)>>9), ((addr&0x01fe)>>1), *val); */ spin_unlock_bh (&adapter->mac_lock);
@@ -66,7 +66,7 @@ static void vsc_write(adapter_t *adapter, u32 addr, u32 data)spin_lock_bh (&adapter->mac_lock);t1_tpi_write (adapter, (addr <<2 ) +4 , data &0xFFFF );t1_tpi_write (adapter, addr <<2 , (data >>16 ) &0xFFFF ); -/* CH_ERR("wr: block: 0x%x sublock: 0x%x reg: 0x%x data: 0x%x\n", +/* pr_err("wr: block: 0x%x sublock: 0x%x reg: 0x%x data: 0x%x\n", ((addr&0xe000)>>13), ((addr&0x1e00)>>9), ((addr&0x01fe)>>1), data); */ spin_unlock_bh (&adapter->mac_lock);
@@ -225,7 +225,7 @@ static void run_table(adapter_t *adapter, struct init_table *ib, int len)for (i =0 ; i < len; i++) {if (ib[i].addr ==INITBLOCK_SLEEP ) {udelay ( ib[i].data ); -CH_ERR ("sleep %d us\n" ,ib[i].data); +pr_err ("sleep %d us\n" ,ib[i].data); }else vsc_write ( adapter, ib[i].addr, ib[i].data ); }
@@ -241,7 +241,7 @@ static int bist_rd(adapter_t *adapter, int moduleid, int address) (address != 0x2) && (address != 0xd) && (address != 0xe)) -CH_ERR ("No bist address: 0x%x\n" , address); +pr_err ("No bist address: 0x%x\n" , address); data = ((0x00 <<24 ) | ((address &0xff ) <<16 ) | (0x00 <<8 ) | ((moduleid &0xff ) <<0 ));
@@ -251,9 +251,9 @@ static int bist_rd(adapter_t *adapter, int moduleid, int address)vsc_read (adapter,REG_RAM_BIST_RESULT , &result);if ((result & (1 <<9 )) !=0x0 ) -CH_ERR ("Still in bist read: 0x%x\n" , result); +pr_err ("Still in bist read: 0x%x\n" , result);else if ((result & (1 <<8 )) !=0x0 ) -CH_ERR ("bist read error: 0x%x\n" , result); +pr_err ("bist read error: 0x%x\n" , result);return (result &0xff ); }
@@ -268,10 +268,10 @@ static int bist_wr(adapter_t *adapter, int moduleid, int address, int value) (address != 0x2) && (address != 0xd) && (address != 0xe)) -CH_ERR ("No bist address: 0x%x\n" , address); +pr_err ("No bist address: 0x%x\n" , address);if (value >255 ) -CH_ERR ("Suspicious write out of range value: 0x%x\n" , value); +pr_err ("Suspicious write out of range value: 0x%x\n" , value); data = ((0x01 <<24 ) | ((address &0xff ) <<16 ) | (value <<8 ) | ((moduleid &0xff ) <<0 ));
@@ -281,9 +281,9 @@ static int bist_wr(adapter_t *adapter, int moduleid, int address, int value)vsc_read (adapter,REG_RAM_BIST_CMD , &result);if ((result & (1 <<27 )) !=0x0 ) -CH_ERR ("Still in bist write: 0x%x\n" , result); +pr_err ("Still in bist write: 0x%x\n" , result);else if ((result & (1 <<26 )) !=0x0 ) -CH_ERR ("bist write error: 0x%x\n" , result); +pr_err ("bist write error: 0x%x\n" , result);return 0 ; }
@@ -306,7 +306,7 @@ static int check_bist(adapter_t *adapter, int moduleid) column = ((bist_rd (adapter,moduleid,0x0e )<<8 ) + (bist_rd (adapter,moduleid,0x0d )));if ((result &3 ) !=0x3 ) -CH_ERR ("Result: 0x%x BIST error in ram %d, column: 0x%04x\n" , +pr_err ("Result: 0x%x BIST error in ram %d, column: 0x%04x\n" , result, moduleid, column);return 0 ; }
Signature · 1 line
1.7.0.14.g7e948
Re: [PATCH net-next 1/7] drivers/net/chelsio: Use pr_<level>, netif_msg_<type>
From: Joe Perches <[email protected]>
Date: Mon, 22 Feb 2010 18:56:57 -0800
Quoted 4 lines
Convert CH_<level> and
CH_DBGuses to pr_<level> and netif equivalents Remove CH_<level> andCH_DBGmacro definitionsSigned-off-by Joe Perches <[email protected]>
Applied, thanks Joe.
BTW:
drivers/net/chelsio/subr.c int t1_elmer0_ext_intr_handler(adapter_t *adapter) · line 738
Quoted 8 lines
drivers/net/chelsio/subr.c +2
-2@@ -734,8 +734,9 @@ int t1_elmer0_ext_intr_handler(adapter_t *adapter)break ;case CHBT_BOARD_8000 :case CHBT_BOARD_CHT110 : -CH_DBG (adapter,INTR ,"External interrupt cause 0x%x\n" , - cause); +if (netif_msg_intr (adapter)) + dev_dbg(&adapter->pdev->dev,
Trailing whitespace on that last line. I fixed it up when adding the patch to my tree.
PATCH 2/7 drivers/net/myri10ge: Use pr_<level> and netdev_<level>
In reply to Joe PerchesAdd #define pr_fmt(fmt)
Convert logging messages to pr_<level> and netdev_<level>
--- drivers/net/myri10ge/myri10ge.c | 183 ++++++++++++++------------------------- 1 files changed, 67 insertions(+), 116 deletions(-)
drivers/net/myri10ge/myri10ge.c +67 -116
@@ -38,6 +38,8 @@* Myricom, Inc., 325N Santa Anita Avenue, Arcadia, CA 91006 *************************************************************************/ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/tcp.h> #include <linux/netdevice.h> #include <linux/skbuff.h>
@@ -819,9 +821,7 @@ static int myri10ge_change_pause(struct myri10ge_priv *mgp, int pause) status =myri10ge_send_cmd (mgp, ctl, &cmd,0 );if (status) { -printk (KERN_ERR -"myri10ge: %s: Failed to set flow control mode\n" , - mgp->dev->name); +netdev_err (mgp->dev,"Failed to set flow control mode\n" );return status; } mgp->pause = pause;
@@ -837,8 +837,7 @@ myri10ge_change_promisc(struct myri10ge_priv *mgp, int promisc, int atomic) ctl = promisc ?MXGEFW_ENABLE_PROMISC :MXGEFW_DISABLE_PROMISC ; status =myri10ge_send_cmd (mgp, ctl, &cmd, atomic);if (status) -printk (KERN_ERR "myri10ge: %s: Failed to set promisc mode\n" , - mgp->dev->name); +netdev_err (mgp->dev,"Failed to set promisc mode\n" ); }static int myri10ge_dma_test (struct myri10ge_priv *mgp,int test_type)
@@ -1482,19 +1481,15 @@ static inline void myri10ge_check_statblock(struct myri10ge_priv *mgp)if (mgp->link_state ==MXGEFW_LINK_UP ) {if (netif_msg_link (mgp)) -printk (KERN_INFO -"myri10ge: %s: link up\n" , - mgp->dev->name); +netdev_info (mgp->dev,"link up\n" );netif_carrier_on (mgp->dev); mgp->link_changes++; }else {if (netif_msg_link (mgp)) -printk (KERN_INFO -"myri10ge: %s: link %s\n" , - mgp->dev->name, - (link_up ==MXGEFW_LINK_MYRINET ? -"mismatch (Myrinet detected)" : -"down" )); +netdev_info (mgp->dev,"link %s\n" , + link_up ==MXGEFW_LINK_MYRINET ? +"mismatch (Myrinet detected)" : +"down" );netif_carrier_off (mgp->dev); mgp->link_changes++; }
@@ -1503,9 +1498,8 @@ static inline void myri10ge_check_statblock(struct myri10ge_priv *mgp) ntohl(stats->rdma_tags_available)) { mgp->rdma_tags_available =ntohl (stats->rdma_tags_available); -printk (KERN_WARNING "myri10ge: %s: RDMA timed out! " -"%d tags left\n" , mgp->dev->name, - mgp->rdma_tags_available); +netdev_warn (mgp->dev,"RDMA timed out! %d tags left\n" , + mgp->rdma_tags_available); } mgp->down_cnt += stats->link_down;if (stats->link_down)
@@ -1576,8 +1570,7 @@ static irqreturn_t myri10ge_intr(int irq, void *arg)if (send_done_count != tx->pkt_done)myri10ge_tx_done (ss, (int )send_done_count);if (unlikely (i > myri10ge_max_irq_loops)) { -printk (KERN_WARNING "myri10ge: %s: irq stuck?\n" , - mgp->dev->name); +netdev_err (mgp->dev,"irq stuck?\n" ); stats->valid =0 ;schedule_work (&mgp->watchdog_work); }
@@ -1614,16 +1607,14 @@ myri10ge_get_settings(struct net_device *netdev, struct ethtool_cmd *cmd)*/ ptr = mgp->product_code_string;if (ptr ==NULL ) { -printk (KERN_ERR "myri10ge: %s: Missing product code\n" , - netdev->name); +netdev_err (netdev,"Missing product code\n" );return 0 ; }for (i =0 ; i <3 ; i++, ptr++) { ptr =strchr (ptr,'-' );if (ptr ==NULL ) { -printk (KERN_ERR "myri10ge: %s: Invalid product " -"code %s\n" , netdev->name, - mgp->product_code_string); +netdev_err (netdev,"Invalid product code %s\n" , + mgp->product_code_string);return 0 ; } }
@@ -2009,17 +2000,15 @@ static int myri10ge_allocate_rings(struct myri10ge_slice_state *ss) mgp->small_bytes + MXGEFW_PAD, 0);if (ss->rx_small.fill_cnt < ss->rx_small.mask +1 ) { -printk (KERN_ERR -"myri10ge: %s:slice-%d: alloced only %d small bufs\n" , - dev->name, slice, ss->rx_small.fill_cnt); +netdev_err (dev,"slice-%d: alloced only %d small bufs\n" , + slice, ss->rx_small.fill_cnt); goto abort_with_rx_small_ring; }myri10ge_alloc_rx_pages (mgp, &ss->rx_big, mgp->big_bytes,0 );if (ss->rx_big.fill_cnt < ss->rx_big.mask +1 ) { -printk (KERN_ERR -"myri10ge: %s:slice-%d: alloced only %d big bufs\n" , - dev->name, slice, ss->rx_big.fill_cnt); +netdev_err (dev,"slice-%d: alloced only %d big bufs\n" , + slice, ss->rx_big.fill_cnt); goto abort_with_rx_big_ring; }
@@ -2358,7 +2347,7 @@ static int myri10ge_open(struct net_device *dev) mgp->running =MYRI10GE_ETH_STARTING ; status =myri10ge_reset (mgp);if (status !=0 ) { -printk (KERN_ERR "myri10ge: %s: failed reset\n" , dev->name); +netdev_err (dev,"failed reset\n" ); goto abort_with_nothing; }
@@ -2370,9 +2359,7 @@ static int myri10ge_open(struct net_device *dev) status =myri10ge_send_cmd (mgp,MXGEFW_CMD_ENABLE_RSS_QUEUES , &cmd,0 );if (status !=0 ) { -printk (KERN_ERR -"myri10ge: %s: failed to set number of slices\n" , - dev->name); +netdev_err (dev,"failed to set number of slices\n" ); goto abort_with_nothing; }/* setup the indirection table */
@@ -2384,9 +2371,7 @@ static int myri10ge_open(struct net_device *dev)MXGEFW_CMD_GET_RSS_TABLE_OFFSET , &cmd, 0);if (status !=0 ) { -printk (KERN_ERR -"myri10ge: %s: failed to setup rss tables\n" , - dev->name); +netdev_err (dev,"failed to setup rss tables\n" ); goto abort_with_nothing; }
@@ -2400,9 +2385,7 @@ static int myri10ge_open(struct net_device *dev) status =myri10ge_send_cmd (mgp,MXGEFW_CMD_SET_RSS_ENABLE , &cmd,0 );if (status !=0 ) { -printk (KERN_ERR -"myri10ge: %s: failed to enable slices\n" , - dev->name); +netdev_err (dev,"failed to enable slices\n" ); goto abort_with_nothing; } }
@@ -2450,9 +2433,7 @@ static int myri10ge_open(struct net_device *dev) status =myri10ge_get_txrx (mgp, slice);if (status !=0 ) { -printk (KERN_ERR -"myri10ge: %s: failed to get ring sizes or locations\n" , - dev->name); +netdev_err (dev,"failed to get ring sizes or locations\n" ); goto abort_with_rings; } status =myri10ge_allocate_rings (ss);
@@ -2465,9 +2446,7 @@ static int myri10ge_open(struct net_device *dev)if (slice ==0 || mgp->dev->real_num_tx_queues >1 ) status =myri10ge_set_stats (mgp, slice);if (status) { -printk (KERN_ERR -"myri10ge: %s: Couldn't set stats DMA\n" , - dev->name); +netdev_err (dev,"Couldn't set stats DMA\n" ); goto abort_with_rings; }
@@ -2498,8 +2477,7 @@ static int myri10ge_open(struct net_device *dev) status |=myri10ge_send_cmd (mgp,MXGEFW_CMD_SET_BIG_BUFFER_SIZE , &cmd,0 );if (status) { -printk (KERN_ERR "myri10ge: %s: Couldn't set buffer sizes\n" , - dev->name); +netdev_err (dev,"Couldn't set buffer sizes\n" ); goto abort_with_rings; }
@@ -2511,8 +2489,7 @@ static int myri10ge_open(struct net_device *dev) cmd.data0 =0 ; status =myri10ge_send_cmd (mgp,MXGEFW_CMD_SET_TSO_MODE , &cmd,0 );if (status && status != -ENOSYS ) { -printk (KERN_ERR "myri10ge: %s: Couldn't set TSO mode\n" , - dev->name); +netdev_err (dev,"Couldn't set TSO mode\n" ); goto abort_with_rings; }
@@ -2521,8 +2498,7 @@ static int myri10ge_open(struct net_device *dev) status =myri10ge_send_cmd (mgp,MXGEFW_CMD_ETHERNET_UP , &cmd,0 );if (status) { -printk (KERN_ERR "myri10ge: %s: Couldn't bring up link\n" , - dev->name); +netdev_err (dev,"Couldn't bring up link\n" ); goto abort_with_rings; }
@@ -2575,15 +2551,12 @@ static int myri10ge_close(struct net_device *dev) status =myri10ge_send_cmd (mgp,MXGEFW_CMD_ETHERNET_DOWN , &cmd,0 );if (status) -printk (KERN_ERR -"myri10ge: %s: Couldn't bring down link\n" , - dev->name); +netdev_err (dev,"Couldn't bring down link\n" );wait_event_timeout (mgp->down_wq, old_down_cnt != mgp->down_cnt,HZ );if (old_down_cnt == mgp->down_cnt) -printk (KERN_ERR "myri10ge: %s never got down irq\n" , - dev->name); +netdev_err (dev,"never got down irq\n" ); }netif_tx_disable (dev);myri10ge_free_irq (mgp);
@@ -2944,9 +2917,7 @@ abort_linearize: idx = (idx +1 ) & tx->mask; }while (idx != last_idx);if (skb_is_gso (skb)) { -printk (KERN_ERR -"myri10ge: %s: TSO but wanted to linearize?!?!?\n" , - mgp->dev->name); +netdev_err (mgp->dev,"TSO but wanted to linearize?!?!?\n" ); goto drop; }
@@ -3043,8 +3014,8 @@ static void myri10ge_set_multicast_list(struct net_device *dev) err =myri10ge_send_cmd (mgp,MXGEFW_ENABLE_ALLMULTI , &cmd,1 );if (err !=0 ) { -printk (KERN_ERR "myri10ge: %s: Failed MXGEFW_ENABLE_ALLMULTI," -" error status: %d\n" , dev->name, err); +netdev_err (dev,"Failed MXGEFW_ENABLE_ALLMULTI, error status: %d\n" , + err); goto abort; }
@@ -3058,9 +3029,8 @@ static void myri10ge_set_multicast_list(struct net_device *dev) err =myri10ge_send_cmd (mgp,MXGEFW_LEAVE_ALL_MULTICAST_GROUPS , &cmd,1 );if (err !=0 ) { -printk (KERN_ERR -"myri10ge: %s: Failed MXGEFW_LEAVE_ALL_MULTICAST_GROUPS" -", error status: %d\n" , dev->name, err); +netdev_err (dev,"Failed MXGEFW_LEAVE_ALL_MULTICAST_GROUPS, error status: %d\n" , + err); goto abort; }
@@ -3073,18 +3043,16 @@ static void myri10ge_set_multicast_list(struct net_device *dev) &cmd, 1);if (err !=0 ) { -printk (KERN_ERR "myri10ge: %s: Failed " -"MXGEFW_JOIN_MULTICAST_GROUP, error status:" -"%d\t" , dev->name, err); -printk (KERN_ERR "MAC %pM\n" , mc_list->dmi_addr); +netdev_err (dev,"Failed MXGEFW_JOIN_MULTICAST_GROUP, error status:%d %pM\n" , + err, mc_list->dmi_addr); goto abort; } }/* Enable multicast filtering */ err =myri10ge_send_cmd (mgp,MXGEFW_DISABLE_ALLMULTI , &cmd,1 );if (err !=0 ) { -printk (KERN_ERR "myri10ge: %s: Failed MXGEFW_DISABLE_ALLMULTI," -"error status: %d\n" , dev->name, err); +netdev_err (dev,"Failed MXGEFW_DISABLE_ALLMULTI, error status: %d\n" , + err); goto abort; }
@@ -3105,9 +3073,8 @@ static int myri10ge_set_mac_address(struct net_device *dev, void *addr) status =myri10ge_update_mac_address (mgp, sa->sa_data);if (status !=0 ) { -printk (KERN_ERR -"myri10ge: %s: changing mac address failed with %d\n" , - dev->name, status); +netdev_err (dev,"changing mac address failed with %d\n" , + status);return status; }
@@ -3122,12 +3089,10 @@ static int myri10ge_change_mtu(struct net_device *dev, int new_mtu)int error =0 ;if ((new_mtu <68 ) || (ETH_HLEN + new_mtu >MYRI10GE_MAX_ETHER_MTU )) { -printk (KERN_ERR "myri10ge: %s: new mtu (%d) is not valid\n" , - dev->name, new_mtu); +netdev_err (dev,"new mtu (%d) is not valid\n" , new_mtu);return -EINVAL ; } -printk (KERN_INFO "%s: changing mtu from %d to %d\n" , - dev->name, dev->mtu, new_mtu); +netdev_info (dev,"changing mtu from %d to %d\n" , dev->mtu, new_mtu);if (mgp->running) {/* if we change the mtu on an active device, we must * reset the device so the firmware sees the change */
@@ -3356,7 +3321,7 @@ static int myri10ge_suspend(struct pci_dev *pdev, pm_message_t state)netif_device_detach (netdev);if (netif_running (netdev)) { -printk (KERN_INFO "myri10ge: closing %s\n" , netdev->name); +netdev_info (netdev,"closing\n" );rtnl_lock ();myri10ge_close (netdev);rtnl_unlock ();
@@ -3383,8 +3348,7 @@ static int myri10ge_resume(struct pci_dev *pdev)msleep (5 );/* give card time to respond */ pci_read_config_word (mgp->pdev,PCI_VENDOR_ID , &vendor);if (vendor ==0xffff ) { -printk (KERN_ERR "myri10ge: %s: device disappeared!\n" , - mgp->dev->name); +netdev_err (mgp->dev,"device disappeared!\n" );return -EIO ; }
@@ -3463,10 +3427,9 @@ static void myri10ge_watchdog(struct work_struct *work)* if the card rebooted due to a parity error * For now, just report it */ reboot =myri10ge_read_reboot (mgp); -printk (KERN_ERR -"myri10ge: %s: NIC rebooted (0x%x),%s resetting\n" , - mgp->dev->name, reboot, - myri10ge_reset_recover ?" " :" not" ); +netdev_err (mgp->dev,"NIC rebooted (0x%x),%s resetting\n" , + reboot, + myri10ge_reset_recover ?"" :" not" );if (myri10ge_reset_recover ==0 )return ;rtnl_lock ();
@@ -3494,31 +3457,26 @@ static void myri10ge_watchdog(struct work_struct *work)if (cmd ==0xffff ) {pci_read_config_word (mgp->pdev,PCI_VENDOR_ID , &vendor);if (vendor ==0xffff ) { -printk (KERN_ERR -"myri10ge: %s: device disappeared!\n" , - mgp->dev->name); +netdev_err (mgp->dev,"device disappeared!\n" );return ; } }/* Perhaps it is a software error. Try to reset */ -printk (KERN_ERR "myri10ge: %s: device timeout, resetting\n" , - mgp->dev->name); +netdev_err (mgp->dev,"device timeout, resetting\n" );for (i =0 ; i < mgp->num_slices; i++) { tx = &mgp->ss[i].tx; -printk (KERN_INFO -"myri10ge: %s: (%d): %d %d %d %d %d %d\n" , - mgp->dev->name, i, tx->queue_active, tx->req, - tx->done, tx->pkt_start, tx->pkt_done, - (int )ntohl (mgp->ss[i].fw_stats-> - send_done_count)); +netdev_err (mgp->dev,"(%d): %d %d %d %d %d %d\n" , + i, tx->queue_active, tx->req, + tx->done, tx->pkt_start, tx->pkt_done, + (int )ntohl (mgp->ss[i].fw_stats-> + send_done_count));msleep (2000 ); -printk (KERN_INFO -"myri10ge: %s: (%d): %d %d %d %d %d %d\n" , - mgp->dev->name, i, tx->queue_active, tx->req, - tx->done, tx->pkt_start, tx->pkt_done, - (int )ntohl (mgp->ss[i].fw_stats-> - send_done_count)); +netdev_info (mgp->dev,"(%d): %d %d %d %d %d %d\n" , + i, tx->queue_active, tx->req, + tx->done, tx->pkt_start, tx->pkt_done, + (int )ntohl (mgp->ss[i].fw_stats-> + send_done_count)); } }
@@ -3528,8 +3486,7 @@ static void myri10ge_watchdog(struct work_struct *work) } status =myri10ge_load_firmware (mgp,1 );if (status !=0 ) -printk (KERN_ERR "myri10ge: %s: failed to load firmware\n" , - mgp->dev->name); +netdev_err (mgp->dev,"failed to load firmware\n" );else myri10ge_open (mgp->dev);rtnl_unlock ();
@@ -3580,14 +3537,10 @@ static void myri10ge_watchdog_timer(unsigned long arg)/* nic seems like it might be stuck.. */ if (rx_pause_cnt != mgp->watchdog_pause) {if (net_ratelimit ()) -printk (KERN_WARNING -"myri10ge %s slice %d:" -"TX paused, check link partner\n" , - mgp->dev->name, i); +netdev_err (mgp->dev,"slice %d: TX paused, check link partner\n" , + i); }else { -printk (KERN_WARNING -"myri10ge %s slice %d stuck:" , - mgp->dev->name, i); +netdev_warn (mgp->dev,"slice %d stuck:" , i); reset_needed =1 ; } }
@@ -4127,13 +4080,11 @@ static struct notifier_block myri10ge_dca_notifier = {static __init int myri10ge_init_module (void ) { -printk (KERN_INFO "%s: Version %s\n" , myri10ge_driver.name, -MYRI10GE_VERSION_STR ); +pr_info ("Version %s\n" ,MYRI10GE_VERSION_STR );if (myri10ge_rss_hash >MXGEFW_RSS_HASH_TYPE_MAX ) { -printk (KERN_ERR -"%s: Illegal rssh hash type %d, defaulting to source port\n" , - myri10ge_driver.name, myri10ge_rss_hash); +pr_err ("Illegal rssh hash type %d, defaulting to source port\n" , + myri10ge_rss_hash); myri10ge_rss_hash =MXGEFW_RSS_HASH_TYPE_SRC_PORT ; }#ifdef CONFIG_MYRI10GE_DCA
Signature · 1 line
1.7.0.14.g7e948
Re: [PATCH net-next 2/7] drivers/net/myri10ge: Use pr_<level> and netdev_<level>
From: Joe Perches <[email protected]>
Date: Mon, 22 Feb 2010 18:56:58 -0800
Quoted 4 lines
Add #define
pr_fmt(fmt)
Convert logging messages to pr_<level> and netdev_<level>Signed-off-by Joe Perches <[email protected]>
Applied.
PATCH 3/7 drivers/net/ixgbe: Use pr_<level> and netif_<level>
In reply to Joe PerchesConvert DPRINTK, commonly used for debugging, to netif_<level> Remove #define PFX
Use #define pr_fmt
Convert a few printks to pr_<level>
--- drivers/net/ixgbe/ixgbe.h | 6 -- drivers/net/ixgbe/ixgbe_common.h | 15 ++++- drivers/net/ixgbe/ixgbe_dcb_nl.c | 5 +- drivers/net/ixgbe/ixgbe_ethtool.c | 40 ++++++++------ drivers/net/ixgbe/ixgbe_fcoe.c | 25 ++++---- drivers/net/ixgbe/ixgbe_main.c | 110 ++++++++++++++++--------------------- drivers/net/ixgbe/ixgbe_phy.c | 2 + drivers/net/ixgbe/ixgbe_sriov.c | 11 ++-- 8 files changed, 106 insertions(+), 108 deletions(-)
drivers/net/ixgbe/ixgbe.h +0 -6
@@ -44,12 +44,6 @@#include <linux/dca.h> #endif -#define PFX "ixgbe: " -#define DPRINTK(nlevel, klevel, fmt, args...) \ - ((void)((NETIF_MSG_##nlevel & adapter->msg_enable) && \ - printk(KERN_##klevel PFX "%s: %s: " fmt, adapter->netdev->name, \ - __func__ , ## args))) -/* TX/RX descriptor defines */ #define IXGBE_DEFAULT_TXD 512#define IXGBE_MAX_TXD 4096
drivers/net/ixgbe/ixgbe_common.h +11 -4
@@ -98,11 +98,18 @@ s32 ixgbe_blink_led_stop_generic(struct ixgbe_hw *hw, u32 index);#define IXGBE_WRITE_FLUSH (a) IXGBE_READ_REG(a, IXGBE_STATUS)#ifdef DEBUG -extern char *ixgbe_get_hw_dev_name (struct ixgbe_hw *hw); -#define hw_dbg(hw, format, arg...) \ - printk(KERN_DEBUG "%s: " format, ixgbe_get_hw_dev_name(hw), ##arg) +#define hw_dbg(_hw, format, arg...) \ + netdev_printk(KERN_DEBUG, \ + ((struct ixgbe_adapter *)(((_hw)->back))->netdev, \ + format, ##arg)#else -#define hw_dbg(hw, format, arg...) do {} while (0) +#define hw_dbg(_hw, format, arg...) \ +do { \ + if (0) \ + netdev_printk(KERN_DEBUG, \ + ((struct ixgbe_adapter *)((_hw)->back))->netdev, \ + format, ##arg); \ +} while (0)#endif #endif /* IXGBE_COMMON */
drivers/net/ixgbe/ixgbe_dcb_nl.c +4 -1
@@ -26,6 +26,8 @@*******************************************************************************/ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include "ixgbe.h" #include <linux/dcbnl.h> #include "ixgbe_dcb_82598.h"
@@ -121,7 +123,8 @@ static u8 ixgbe_dcbnl_set_state(struct net_device *netdev, u8 state) goto out;if (!(adapter->flags &IXGBE_FLAG_MSIX_ENABLED )) { -DPRINTK (DRV ,ERR ,"Enable failed, needs MSI-X\n" ); +netif_err (adapter, drv, adapter->netdev, +"Enable failed, needs MSI-X\n" ); err =1 ; goto out; }
drivers/net/ixgbe/ixgbe_ethtool.c +23 -17
@@ -25,6 +25,8 @@*******************************************************************************/ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +/* ethtool support for ixgbe */ #include <linux/types.h>
@@ -293,8 +295,8 @@ static int ixgbe_set_settings(struct net_device *netdev, hw->mac.autotry_restart = true; err = hw->mac.ops.setup_link (hw, advertised, true, true);if (err) { -DPRINTK (PROBE ,INFO , -"setup link failed with code %d\n" , err); +netif_info (adapter, probe, adapter->netdev, +"setup link failed with code %d\n" , err); hw->mac.ops.setup_link (hw, old, true, true); } }else {
@@ -1189,8 +1191,9 @@ static struct ixgbe_reg_test reg_test_82598[] = {writel ((_test[pat] &W ), (adapter->hw.hw_addr +R )); \ val =readl (adapter->hw.hw_addr +R ); \if (val != (_test[pat] &W &M )) { \ -DPRINTK (DRV ,ERR ,"pattern test reg %04X failed: got " \ -"0x%08X expected 0x%08X\n" , \ +netif_err (adapter, drv, adapter->netdev, \ +"pattern test reg %04X failed: got " \ +"0x%08X expected 0x%08X\n" , \R , val, (_test[pat] &W &M )); \ *data =R ; \writel (before, adapter->hw.hw_addr +R ); \
@@ -1207,8 +1210,9 @@ static struct ixgbe_reg_test reg_test_82598[] = {writel ((W &M ), (adapter->hw.hw_addr +R )); \ val =readl (adapter->hw.hw_addr +R ); \if ((W &M ) != (val &M )) { \ -DPRINTK (DRV ,ERR ,"set/check reg %04X test failed: got 0x%08X " \ -"expected 0x%08X\n" ,R , (val &M ), (W &M )); \ +netif_err (adapter, drv, adapter->netdev, \ +"set/check reg %04X test failed: got 0x%08X " \ +"expected 0x%08X\n" ,R , (val &M ), (W &M )); \ *data =R ; \writel (before, (adapter->hw.hw_addr +R )); \return 1 ; \
@@ -1241,8 +1245,9 @@ static int ixgbe_reg_test(struct ixgbe_adapter *adapter, u64 *data)IXGBE_WRITE_REG (&adapter->hw,IXGBE_STATUS , toggle); after =IXGBE_READ_REG (&adapter->hw,IXGBE_STATUS ) & toggle;if (value != after) { -DPRINTK (DRV ,ERR ,"failed STATUS register test got: " -"0x%08X expected: 0x%08X\n" , after, value); +netif_err (adapter, drv, adapter->netdev, +"failed STATUS register test got: " +"0x%08X expected: 0x%08X\n" , after, value); *data =1 ;return 1 ; }
@@ -1342,8 +1347,9 @@ static int ixgbe_intr_test(struct ixgbe_adapter *adapter, u64 *data) *data =1 ;return -1 ; } -DPRINTK (HW ,INFO ,"testing %s interrupt\n" , - (shared_int ?"shared" :"unshared" )); +netif_info (adapter, hw, adapter->netdev, +"testing %s interrupt\n" , + shared_int ?"shared" :"unshared" );/* Disable all the interrupts */ IXGBE_WRITE_REG (&adapter->hw,IXGBE_EIMC ,0xFFFFFFFF );
@@ -1848,7 +1854,7 @@ static void ixgbe_diag_test(struct net_device *netdev,if (eth_test->flags ==ETH_TEST_FL_OFFLINE ) {/* Offline tests */ -DPRINTK (HW ,INFO ,"offline testing starting\n" ); +netif_info (adapter, hw, adapter->netdev,"offline testing starting\n" );/* Link test performed before hardware reset so autoneg doesn't * interfere with test result */
@@ -1861,17 +1867,17 @@ static void ixgbe_diag_test(struct net_device *netdev,else ixgbe_reset (adapter); -DPRINTK (HW ,INFO ,"register testing starting\n" ); +netif_info (adapter, hw, adapter->netdev,"register testing starting\n" );if (ixgbe_reg_test (adapter, &data[0 ])) eth_test->flags |=ETH_TEST_FL_FAILED ;ixgbe_reset (adapter); -DPRINTK (HW ,INFO ,"eeprom testing starting\n" ); +netif_info (adapter, hw, adapter->netdev,"eeprom testing starting\n" );if (ixgbe_eeprom_test (adapter, &data[1 ])) eth_test->flags |=ETH_TEST_FL_FAILED ;ixgbe_reset (adapter); -DPRINTK (HW ,INFO ,"interrupt testing starting\n" ); +netif_info (adapter, hw, adapter->netdev,"interrupt testing starting\n" );if (ixgbe_intr_test (adapter, &data[2 ])) eth_test->flags |=ETH_TEST_FL_FAILED ;
@@ -1879,14 +1885,14 @@ static void ixgbe_diag_test(struct net_device *netdev,* loopback diagnostic. */ if (adapter->flags & (IXGBE_FLAG_SRIOV_ENABLED |IXGBE_FLAG_VMDQ_ENABLED )) { -DPRINTK (HW ,INFO ,"Skip MAC loopback diagnostic in VT " +netif_info (adapter, hw, adapter->netdev,"Skip MAC loopback diagnostic in VT " "mode\n" ); data[3 ] =0 ; goto skip_loopback; }ixgbe_reset (adapter); -DPRINTK (HW ,INFO ,"loopback testing starting\n" ); +netif_info (adapter, hw, adapter->netdev,"loopback testing starting\n" );if (ixgbe_loopback_test (adapter, &data[3 ])) eth_test->flags |=ETH_TEST_FL_FAILED ;
@@ -1897,7 +1903,7 @@ skip_loopback:if (if_running)dev_open (netdev); }else { -DPRINTK (HW ,INFO ,"online testing starting\n" ); +netif_info (adapter, hw, adapter->netdev,"online testing starting\n" );/* Online tests */ if (ixgbe_link_test (adapter, &data[4 ])) eth_test->flags |=ETH_TEST_FL_FAILED ;
drivers/net/ixgbe/ixgbe_fcoe.c +13 -12
@@ -25,6 +25,7 @@*******************************************************************************/ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt#include "ixgbe.h" #ifdef CONFIG_IXGBE_DCB
@@ -163,19 +164,19 @@ int ixgbe_fcoe_ddp_get(struct net_device *netdev, u16 xid, adapter =netdev_priv (netdev);if (xid >=IXGBE_FCOE_DDP_MAX ) { -DPRINTK (DRV ,WARNING ,"xid=0x%x out-of-range\n" , xid); +netif_warn (adapter, drv, adapter->netdev,"xid=0x%x out-of-range\n" , xid);return 0 ; } fcoe = &adapter->fcoe;if (!fcoe->pool) { -DPRINTK (DRV ,WARNING ,"xid=0x%x no ddp pool for fcoe\n" , xid); +netif_warn (adapter, drv, adapter->netdev,"xid=0x%x no ddp pool for fcoe\n" , xid);return 0 ; } ddp = &fcoe->ddp[xid];if (ddp->sgl) { -DPRINTK (DRV ,ERR ,"xid 0x%x w/ non-null sgl=%p nents=%d\n" , +netif_err (adapter, drv, adapter->netdev,"xid 0x%x w/ non-null sgl=%p nents=%d\n" , xid, ddp->sgl, ddp->sgc);return 0 ; }
@@ -184,14 +185,14 @@ int ixgbe_fcoe_ddp_get(struct net_device *netdev, u16 xid,/* setup dma from scsi command sgl */ dmacount =pci_map_sg (adapter->pdev, sgl, sgc,DMA_FROM_DEVICE );if (dmacount ==0 ) { -DPRINTK (DRV ,ERR ,"xid 0x%x DMA map error\n" , xid); +netif_err (adapter, drv, adapter->netdev,"xid 0x%x DMA map error\n" , xid);return 0 ; }/* alloc the udl from our ddp pool */ ddp->udl =pci_pool_alloc (fcoe->pool,GFP_KERNEL , &ddp->udp);if (!ddp->udl) { -DPRINTK (DRV ,ERR ,"failed allocated ddp context\n" ); +netif_err (adapter, drv, adapter->netdev,"failed allocated ddp context\n" ); goto out_noddp_unmap; } ddp->sgl = sgl;
@@ -229,7 +230,7 @@ int ixgbe_fcoe_ddp_get(struct net_device *netdev, u16 xid, j++;/* max number of buffers allowed in one DDP context */ if (j >IXGBE_BUFFCNT_MAX ) { -DPRINTK (DRV ,ERR ,"xid=%x:%d,%d,%d:addr=%llx " +netif_err (adapter, drv, adapter->netdev,"xid=%x:%d,%d,%d:addr=%llx " "not enough descriptors\n" , xid, i, j, dmacount, (u64 )addr); goto out_noddp_free;
@@ -381,7 +382,7 @@ int ixgbe_fso(struct ixgbe_adapter *adapter,struct fc_frame_header *fh;if (skb_is_gso (skb) && (skb_shinfo (skb)->gso_type !=SKB_GSO_FCOE )) { -DPRINTK (DRV ,ERR ,"Wrong gso type %d:expecting SKB_GSO_FCOE\n" , +netif_err (adapter, drv, adapter->netdev,"Wrong gso type %d:expecting SKB_GSO_FCOE\n" ,skb_shinfo (skb)->gso_type);return -EINVAL ; }
@@ -408,7 +409,7 @@ int ixgbe_fso(struct ixgbe_adapter *adapter, fcoe_sof_eof |=IXGBE_ADVTXD_FCOEF_SOF ;break ;default : -DPRINTK (DRV ,WARNING ,"unknown sof = 0x%x\n" , sof); +netif_warn (adapter, drv, adapter->netdev,"unknown sof = 0x%x\n" , sof);return -EINVAL ; }
@@ -435,7 +436,7 @@ int ixgbe_fso(struct ixgbe_adapter *adapter, fcoe_sof_eof |=IXGBE_ADVTXD_FCOEF_EOF_A ;break ;default : -DPRINTK (DRV ,WARNING ,"unknown eof = 0x%x\n" , eof); +netif_warn (adapter, drv, adapter->netdev,"unknown eof = 0x%x\n" , eof);return -EINVAL ; }
@@ -511,7 +512,7 @@ void ixgbe_configure_fcoe(struct ixgbe_adapter *adapter) adapter->pdev,IXGBE_FCPTR_MAX , IXGBE_FCPTR_ALIGN, PAGE_SIZE);if (!fcoe->pool) -DPRINTK (DRV ,ERR , +netif_err (adapter, drv, adapter->netdev,"failed to allocated FCoE DDP pool\n" );spin_lock_init (&fcoe->lock);
@@ -599,7 +600,7 @@ int ixgbe_fcoe_enable(struct net_device *netdev)if (adapter->flags &IXGBE_FLAG_FCOE_ENABLED ) goto out_enable; -DPRINTK (DRV ,INFO ,"Enabling FCoE offload features.\n" ); +netif_info (adapter, drv, adapter->netdev,"Enabling FCoE offload features.\n" );if (netif_running (netdev)) netdev->netdev_ops->ndo_stop (netdev);
@@ -645,7 +646,7 @@ int ixgbe_fcoe_disable(struct net_device *netdev)if (!(adapter->flags &IXGBE_FLAG_FCOE_ENABLED )) goto out_disable; -DPRINTK (DRV ,INFO ,"Disabling FCoE offload features.\n" ); +netif_info (adapter, drv, adapter->netdev,"Disabling FCoE offload features.\n" );if (netif_running (netdev)) netdev->netdev_ops->ndo_stop (netdev);
drivers/net/ixgbe/ixgbe_main.c +47 -63
356 lines not on this page · raw message
drivers/net/ixgbe/ixgbe_phy.c +2 -0
@@ -28,7 +28,9 @@#include <linux/pci.h> #include <linux/delay.h> #include <linux/sched.h> +#include <linux/netdevice.h> +#include "ixgbe.h" #include "ixgbe_common.h" #include "ixgbe_phy.h"
drivers/net/ixgbe/ixgbe_sriov.c +6 -5
@@ -25,6 +25,7 @@*******************************************************************************/ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt#include <linux/types.h> #include <linux/module.h>
@@ -152,7 +153,7 @@ int ixgbe_set_vf_mac(struct ixgbe_adapter *adapter, adapter->vfinfo[vf].rar = hw->mac.ops.set_rar (hw, vf +1 , mac_addr, vf,IXGBE_RAH_AV );if (adapter->vfinfo[vf].rar <0 ) { -DPRINTK (DRV ,ERR ,"Could not set MAC Filter for VF %d\n" , vf); +netif_err (adapter, drv, adapter->netdev,"Could not set MAC Filter for VF %d\n" , vf);return -1 ; }
@@ -172,7 +173,7 @@ int ixgbe_vf_configuration(struct pci_dev *pdev, unsigned int event_mask)if (enable) {random_ether_addr (vf_mac_addr); - DPRINTK(PROBE, INFO, "IOV: VF %d is enabled " + netif_info(adapter, probe, adapter->netdev, "IOV: VF %d is enabled " "mac %02X:%02X:%02X:%02X:%02X:%02X\n", vfn, vf_mac_addr[0], vf_mac_addr[1], vf_mac_addr[2],
@@ -221,7 +222,7 @@ static int ixgbe_rcv_msg_from_vf(struct ixgbe_adapter *adapter, u32 vf) retval =ixgbe_read_mbx (hw, msgbuf, mbx_size, vf);if (retval) -printk (KERN_ERR "Error receiving message from VF\n" ); +pr_err ("Error receiving message from VF\n" );/* this is a message we already processed, do nothing */ if (msgbuf[0 ] & (IXGBE_VT_MSGTYPE_ACK |IXGBE_VT_MSGTYPE_NACK ))
@@ -235,7 +236,7 @@ static int ixgbe_rcv_msg_from_vf(struct ixgbe_adapter *adapter, u32 vf)if (msgbuf[0 ] ==IXGBE_VF_RESET ) {unsigned char *vf_mac = adapter->vfinfo[vf].vf_mac_addresses;u8 *addr = (u8 *)(&msgbuf[1 ]); -DPRINTK (PROBE ,INFO ,"VF Reset msg received from vf %d\n" , vf); +netif_info (adapter, probe, adapter->netdev,"VF Reset msg received from vf %d\n" , vf); adapter->vfinfo[vf].clear_to_send = false;ixgbe_vf_reset_msg (adapter, vf); adapter->vfinfo[vf].clear_to_send = true;
@@ -286,7 +287,7 @@ static int ixgbe_rcv_msg_from_vf(struct ixgbe_adapter *adapter, u32 vf) retval =ixgbe_set_vf_vlan (adapter, add, vid, vf);break ;default : -DPRINTK (DRV ,ERR ,"Unhandled Msg %8.8x\n" , msgbuf[0 ]); +netif_err (adapter, drv, adapter->netdev,"Unhandled Msg %8.8x\n" , msgbuf[0 ]); retval =IXGBE_ERR_MBX ;break ; }
Signature · 14 lines
1.7.0.14.g7e948 ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ E1000-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/e1000-devel To learn more about Intel® Ethernet, visit http://communities.intel.com/community/wired
PATCH 4/7 drivers/net/ixgb: Use pr_<level> and netdev_<level>
In reply to Joe PerchesConvert DEBUGOUTx to pr_debug
Convert DEBUGFUNC to more commonly used ENTER
Convert mac address output to %pM
Use #define pr_fmt
Convert a few printks to pr_<level>
Improve ixgb_mc_addr_list_update: use a temporary for current mc address Use etherdevice.h functions for mac address testing
--- drivers/net/ixgb/ixgb.h | 8 ++- drivers/net/ixgb/ixgb_ee.c | 14 ++-- drivers/net/ixgb/ixgb_hw.c | 147 +++++++++++++++++------------------------ drivers/net/ixgb/ixgb_hw.h | 12 ---- drivers/net/ixgb/ixgb_main.c | 33 ++++----- drivers/net/ixgb/ixgb_osdep.h | 16 +---- drivers/net/ixgb/ixgb_param.c | 31 ++++----- 7 files changed, 105 insertions(+), 156 deletions(-)
drivers/net/ixgb/ixgb.h +6 -2
@@ -78,9 +78,13 @@ struct ixgb_adapter;#define PFX "ixgb: "#ifdef _DEBUG_DRIVER_ -#define IXGB_DBG(args...) printk(KERN_DEBUG PFX args) +#define IXGB_DBG(fmt, args...) printk(KERN_DEBUG PFX fmt, ##args)#else -#define IXGB_DBG(args...) +#define IXGB_DBG(fmt, args...) \ +do { \ + if (0) \ + printk(KERN_DEBUG PFX fmt, ##args); \ +} while (0)#endif /* TX/RX descriptor defines */
drivers/net/ixgb/ixgb_ee.c +8 -6
@@ -26,6 +26,8 @@*******************************************************************************/ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include "ixgb_hw.h" #include "ixgb_ee.h" /* Local prototypes */
@@ -467,11 +469,11 @@ ixgb_get_eeprom_data(struct ixgb_hw *hw)u16 checksum =0 ;struct ixgb_ee_map_type *ee_map; -DEBUGFUNC ("ixgb_get_eeprom_data" ); +ENTER (); ee_map = (struct ixgb_ee_map_type *)hw->eeprom; -DEBUGOUT ("ixgb_ee: Reading eeprom data\n" ); +pr_debug ("Reading eeprom data\n" );for (i =0 ; i <IXGB_EEPROM_SIZE ; i++) {u16 ee_data; ee_data =ixgb_read_eeprom (hw, i);
@@ -480,7 +482,7 @@ ixgb_get_eeprom_data(struct ixgb_hw *hw) }if (checksum != (u16 )EEPROM_SUM ) { -DEBUGOUT ("ixgb_ee: Checksum invalid.\n" ); +pr_debug ("Checksum invalid\n" );/* clear the init_ctrl_reg_1 to signify that the cache is * invalidated */ ee_map->init_ctrl_reg_1 =cpu_to_le16 (EEPROM_ICW1_SIGNATURE_CLEAR );
@@ -489,7 +491,7 @@ ixgb_get_eeprom_data(struct ixgb_hw *hw)if ((ee_map->init_ctrl_reg_1 &cpu_to_le16 (EEPROM_ICW1_SIGNATURE_MASK )) !=cpu_to_le16 (EEPROM_ICW1_SIGNATURE_VALID )) { -DEBUGOUT ("ixgb_ee: Signature invalid.\n" ); +pr_debug ("Signature invalid\n" );return (false); }
@@ -555,13 +557,13 @@ ixgb_get_ee_mac_addr(struct ixgb_hw *hw,int i;struct ixgb_ee_map_type *ee_map = (struct ixgb_ee_map_type *)hw->eeprom; -DEBUGFUNC ("ixgb_get_ee_mac_addr" ); +ENTER ();if (ixgb_check_and_get_eeprom_data (hw) == true) {for (i =0 ; i <IXGB_ETH_LENGTH_OF_ADDRESS ; i++) { mac_addr[i] = ee_map->mac_addr[i]; -DEBUGOUT2 ("mac(%d) = %.2X\n" , i, mac_addr[i]); } +pr_debug ("eeprom mac address = %pM\n" , mac_addr); } }
drivers/net/ixgb/ixgb_hw.c +61 -86
376 lines not on this page · raw message
drivers/net/ixgb/ixgb_hw.h +0 -12
@@ -636,18 +636,6 @@ struct ixgb_flash_buffer {u8 filler3[0xAAAA ]; }; -/* -* This is a little-endian specific check. -*/ -#define IS_MULTICAST (Address) \ - (bool)(((u8 *)(Address))[0] & ((u8)0x01)) - -/* -* Check whether an address is broadcast. -*/ -#define IS_BROADCAST (Address) \ - ((((u8 *)(Address))[0] == ((u8)0xff)) && (((u8 *)(Address))[1] == ((u8)0xff))) -/* Flow control parameters */ struct ixgb_fc {u32 high_water;/* Flow Control High-water */
drivers/net/ixgb/ixgb_main.c +15 -18
@@ -26,6 +26,8 @@*******************************************************************************/ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include "ixgb.h" char ixgb_driver_name[] ="ixgb" ;
@@ -146,10 +148,8 @@ MODULE_PARM_DESC(debug, "Debug level (0=none,...,16=all)");static int __init ixgb_init_module (void ) { -printk (KERN_INFO "%s - version %s\n" , - ixgb_driver_string, ixgb_driver_version); - -printk (KERN_INFO "%s\n" , ixgb_copyright); +pr_info ("%s - version %s\n" , ixgb_driver_string, ixgb_driver_version); +pr_info ("%s\n" , ixgb_copyright);return pci_register_driver (&ixgb_driver); }
@@ -374,8 +374,7 @@ ixgb_probe(struct pci_dev *pdev, const struct pci_device_id *ent) }else {if ((err =pci_set_dma_mask (pdev,DMA_BIT_MASK (32 ))) || (err =pci_set_consistent_dma_mask (pdev,DMA_BIT_MASK (32 )))) { -printk (KERN_ERR -"ixgb: No usable DMA configuration, aborting\n" ); +pr_err ("No usable DMA configuration, aborting\n" ); goto err_dma_mask; } pci_using_dac =0 ;
@@ -1119,15 +1118,14 @@ ixgb_watchdog(unsigned long data)if (adapter->hw.link_up) {if (!netif_carrier_ok (netdev)) { -printk (KERN_INFO "ixgb: %s NIC Link is Up 10 Gbps " -"Full Duplex, Flow Control: %s\n" , - netdev->name, - (adapter->hw.fc.type == ixgb_fc_full) ? -"RX/TX" : - ((adapter->hw.fc.type == ixgb_fc_rx_pause) ? -"RX" : - ((adapter->hw.fc.type == ixgb_fc_tx_pause) ? -"TX" :"None" ))); +netdev_info (netdev, +"NIC Link is Up 10 Gbps Full Duplex, Flow Control: %s\n" , + (adapter->hw.fc.type == ixgb_fc_full) ? +"RX/TX" : + (adapter->hw.fc.type == ixgb_fc_rx_pause) ? +"RX" : + (adapter->hw.fc.type == ixgb_fc_tx_pause) ? +"TX" :"None" ); adapter->link_speed =10000 ; adapter->link_duplex =FULL_DUPLEX ;netif_carrier_on (netdev);
@@ -1136,8 +1134,7 @@ ixgb_watchdog(unsigned long data)if (netif_carrier_ok (netdev)) { adapter->link_speed =0 ; adapter->link_duplex =0 ; -printk (KERN_INFO "ixgb: %s NIC Link is Down\n" , - netdev->name); +netdev_info (netdev,"NIC Link is Down\n" );netif_carrier_off (netdev); } }
@@ -2323,7 +2320,7 @@ static void ixgb_io_resume(struct pci_dev *pdev)if (netif_running (netdev)) {if (ixgb_up (adapter)) { -printk ("ixgb: can't bring device back up after reset\n" ); +pr_err ("can't bring device back up after reset\n" );return ; } }
drivers/net/ixgb/ixgb_osdep.h +2 -14
@@ -41,20 +41,8 @@#undef ASSERT#define ASSERT (x) BUG_ON(!(x)) -#define MSGOUT (S ,A ,B ) printk(KERN_DEBUG S "\n", A, B) - -#ifdef DBG -#define DEBUGOUT (S ) printk(KERN_DEBUG S "\n") -#define DEBUGOUT1(S, A...) printk(KERN_DEBUG S "\n", A) -#else -#define DEBUGOUT (S ) -#define DEBUGOUT1(S, A...) -#endif - -#define DEBUGFUNC (F ) DEBUGOUT(F) -#define DEBUGOUT2 DEBUGOUT1 -#define DEBUGOUT3 DEBUGOUT2 -#define DEBUGOUT7 DEBUGOUT3 + +#define ENTER () pr_debug("%s\n", __func__);#define IXGB_WRITE_REG (a, reg, value) ( \ writel((value), ((a)->hw_addr + IXGB_##reg)))
drivers/net/ixgb/ixgb_param.c +13 -18
@@ -26,6 +26,8 @@*******************************************************************************/ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include "ixgb.h" /* This is the only thing that needs to be changed to adjust the
@@ -209,16 +211,16 @@ ixgb_validate_option(unsigned int *value, const struct ixgb_option *opt)case enable_option:switch (*value) {case OPTION_ENABLED : -printk (KERN_INFO "%s Enabled\n" , opt->name); +pr_info ("%s Enabled\n" , opt->name);return 0 ;case OPTION_DISABLED : -printk (KERN_INFO "%s Disabled\n" , opt->name); +pr_info ("%s Disabled\n" , opt->name);return 0 ; }break ;case range_option:if (*value >= opt->arg.r.min && *value <= opt->arg.r.max) { -printk (KERN_INFO "%s set to %i\n" , opt->name, *value); +pr_info ("%s set to %i\n" , opt->name, *value);return 0 ; }break ;
@@ -230,7 +232,7 @@ ixgb_validate_option(unsigned int *value, const struct ixgb_option *opt) ent = &opt->arg.l.p[i];if (*value == ent->i) {if (ent->str[0 ] !='\0' ) -printk (KERN_INFO "%s\n" , ent->str); +pr_info ("%s\n" , ent->str);return 0 ; } }
@@ -240,8 +242,7 @@ ixgb_validate_option(unsigned int *value, const struct ixgb_option *opt)BUG (); } -printk (KERN_INFO "Invalid %s specified (%i) %s\n" , - opt->name, *value, opt->err); +pr_info ("Invalid %s specified (%i) %s\n" , opt->name, *value, opt->err); *value = opt->def;return -1 ; }
@@ -261,9 +262,8 @@ ixgb_check_options(struct ixgb_adapter *adapter) {int bd = adapter->bd_number;if (bd >=IXGB_MAX_NIC ) { -printk (KERN_NOTICE -"Warning: no configuration for board #%i\n" , bd); -printk (KERN_NOTICE "Using defaults for all values\n" ); +pr_notice ("Warning: no configuration for board #%i\n" , bd); +pr_notice ("Using defaults for all values\n" ); } {/* Transmit Descriptor Count */
@@ -363,8 +363,7 @@ ixgb_check_options(struct ixgb_adapter *adapter) adapter->hw.fc.high_water = opt.def; }if (!(adapter->hw.fc.type & ixgb_fc_tx_pause) ) -printk (KERN_INFO -"Ignoring RxFCHighThresh when no RxFC\n" ); +pr_info ("Ignoring RxFCHighThresh when no RxFC\n" ); } {/* Receive Flow Control Low Threshold */ const struct ixgb_option opt = {
@@ -383,8 +382,7 @@ ixgb_check_options(struct ixgb_adapter *adapter) adapter->hw.fc.low_water = opt.def; }if (!(adapter->hw.fc.type & ixgb_fc_tx_pause) ) -printk (KERN_INFO -"Ignoring RxFCLowThresh when no RxFC\n" ); +pr_info ("Ignoring RxFCLowThresh when no RxFC\n" ); } {/* Flow Control Pause Time Request*/ const struct ixgb_option opt = {
@@ -404,17 +402,14 @@ ixgb_check_options(struct ixgb_adapter *adapter) adapter->hw.fc.pause_time = opt.def; }if (!(adapter->hw.fc.type & ixgb_fc_tx_pause) ) -printk (KERN_INFO -"Ignoring FCReqTimeout when no RxFC\n" ); +pr_info ("Ignoring FCReqTimeout when no RxFC\n" ); }/* high low and spacing check for rx flow control thresholds */ if (adapter->hw.fc.type & ixgb_fc_tx_pause) {/* high must be greater than low */ if (adapter->hw.fc.high_water < (adapter->hw.fc.low_water +8 )) {/* set defaults */ -printk (KERN_INFO -"RxFCHighThresh must be >= (RxFCLowThresh + 8), " -"Using Defaults\n" ); +pr_info ("RxFCHighThresh must be >= (RxFCLowThresh + 8), Using Defaults\n" ); adapter->hw.fc.high_water =DEFAULT_FCRTH ; adapter->hw.fc.low_water =DEFAULT_FCRTL ; }
Signature · 14 lines
1.7.0.14.g7e948 ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ E1000-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/e1000-devel To learn more about Intel® Ethernet, visit http://communities.intel.com/community/wired
PATCH 5/7 drivers/net/e1000: Use pr_<level> and netif_<level>
In reply to Joe PerchesConvert DPRINTK, commonly used for debugging, to netif_<level> Remove #define PFX
Use #define pr_fmt
Convert DEBUGOUTx to pr_debug
Convert DEBUGFUNC to more commonly used ENTER() Convert some printks to pr_<level>
Coalesce long formats
--- drivers/net/e1000/e1000.h | 17 -- drivers/net/e1000/e1000_ethtool.c | 38 ++-- drivers/net/e1000/e1000_hw.c | 383 ++++++++++++++++++------------------- drivers/net/e1000/e1000_main.c | 272 +++++++++++++------------- drivers/net/e1000/e1000_osdep.h | 14 +-- drivers/net/e1000/e1000_param.c | 121 +++++++------ 6 files changed, 409 insertions(+), 436 deletions(-)
drivers/net/e1000/e1000.h +0 -17
@@ -81,23 +81,6 @@ struct e1000_adapter;#include "e1000_hw.h" -#ifdef DBG -#define E1000_DBG(args...) printk(KERN_DEBUG "e1000: " args) -#else -#define E1000_DBG(args...) -#endif - -#define E1000_ERR(args...) printk(KERN_ERR "e1000: " args) - -#define PFX "e1000: " - -#define DPRINTK(nlevel, klevel, fmt, args...) \ -do { \ - if (NETIF_MSG_##nlevel & adapter->msg_enable) \ - printk(KERN_##klevel PFX "%s: %s: " fmt, \ - adapter->netdev->name, __func__, ##args); \ -} while (0) -#define E1000_MAX_INTR 10/* TX/RX descriptor defines */
drivers/net/e1000/e1000_ethtool.c +21 -17
@@ -346,7 +346,8 @@ static int e1000_set_tso(struct net_device *netdev, u32 data) netdev->features &= ~NETIF_F_TSO6 ; -DPRINTK (PROBE ,INFO ,"TSO is %s\n" , data ?"Enabled" :"Disabled" ); +netif_info (adapter, probe, adapter->netdev, +"TSO is %s\n" , data ?"Enabled" :"Disabled" ); adapter->tso_force = true;return 0 ; }
@@ -714,9 +715,9 @@ static bool reg_pattern_test(struct e1000_adapter *adapter, u64 *data, int reg,writel (write & test[i], address); read =readl (address);if (read != (write & test[i] & mask)) { -DPRINTK (DRV ,ERR ,"pattern test reg %04X failed: " -"got 0x%08X expected 0x%08X\n" , - reg, read, (write & test[i] & mask)); +netif_err (adapter, drv, adapter->netdev, +"pattern test reg %04X failed: got 0x%08X expected 0x%08X\n" , + reg, read, (write & test[i] & mask)); *data = reg;return true; }
@@ -734,9 +735,9 @@ static bool reg_set_and_check(struct e1000_adapter *adapter, u64 *data, int reg,writel (write & mask, address); read =readl (address);if ((read & mask) != (write & mask)) { -DPRINTK (DRV ,ERR ,"set/check reg %04X test failed: " -"got 0x%08X expected 0x%08X\n" , - reg, (read & mask), (write & mask)); +netif_err (adapter, drv, adapter->netdev, +"set/check reg %04X test failed: got 0x%08X expected 0x%08X\n" , + reg, (read & mask), (write & mask)); *data = reg;return true; }
@@ -779,8 +780,9 @@ static int e1000_reg_test(struct e1000_adapter *adapter, u64 *data)ew32 (STATUS , toggle); after =er32 (STATUS ) & toggle;if (value != after) { -DPRINTK (DRV ,ERR ,"failed STATUS register test got: " -"0x%08X expected: 0x%08X\n" , after, value); +netif_err (adapter, drv, adapter->netdev, +"failed STATUS register test got: 0x%08X expected: 0x%08X\n" , + after, value); *data =1 ;return 1 ; }
@@ -894,8 +896,8 @@ static int e1000_intr_test(struct e1000_adapter *adapter, u64 *data) *data =1 ;return -1 ; } -DPRINTK (HW ,INFO ,"testing %s interrupt\n" , - (shared_int ?"shared" :"unshared" )); +netif_info (adapter, hw, adapter->netdev,"testing %s interrupt\n" , + shared_int ?"shared" :"unshared" );/* Disable all the interrupts */ ew32 (IMC ,0xFFFFFFFF );
@@ -1558,7 +1560,8 @@ static void e1000_diag_test(struct net_device *netdev,u8 forced_speed_duplex = hw->forced_speed_duplex;u8 autoneg = hw->autoneg; -DPRINTK (HW ,INFO ,"offline testing starting\n" ); +netif_info (adapter, hw, adapter->netdev, +"offline testing starting\n" );/* Link test performed before hardware reset so autoneg doesn't * interfere with test result */
@@ -1598,7 +1601,8 @@ static void e1000_diag_test(struct net_device *netdev,if (if_running)dev_open (netdev); }else { -DPRINTK (HW ,INFO ,"online testing starting\n" ); +netif_info (adapter, hw, adapter->netdev, +"online testing starting\n" );/* Online tests */ if (e1000_link_test (adapter, &data[4 ])) eth_test->flags |=ETH_TEST_FL_FAILED ;
@@ -1691,8 +1695,8 @@ static void e1000_get_wol(struct net_device *netdev, wol->supported &= ~WAKE_UCAST ;if (adapter->wol &E1000_WUFC_EX ) -DPRINTK (DRV ,ERR ,"Interface does not support " -"directed (unicast) frame wake-up packets\n" ); +netif_err (adapter, drv, adapter->netdev, +"Interface does not support directed (unicast) frame wake-up packets\n" );break ;default :break ;
@@ -1725,8 +1729,8 @@ static int e1000_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)switch (hw->device_id) {case E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3 :if (wol->wolopts &WAKE_UCAST ) { -DPRINTK (DRV ,ERR ,"Interface does not support " -"directed (unicast) frame wake-up packets\n" ); +netif_err (adapter, drv, adapter->netdev, +"Interface does not support directed (unicast) frame wake-up packets\n" );return -EOPNOTSUPP ; }break ;
drivers/net/e1000/e1000_hw.c +183 -200
1,307 lines not on this page · raw message
drivers/net/e1000/e1000_main.c +138 -134
556 lines not on this page · raw message
drivers/net/e1000/e1000_osdep.h +1 -13
@@ -41,19 +41,7 @@#include <linux/interrupt.h> #include <linux/sched.h> -#ifdef DBG -#define DEBUGOUT (S ) printk(KERN_DEBUG S "\n") -#define DEBUGOUT1(S, A...) printk(KERN_DEBUG S "\n", A) -#else -#define DEBUGOUT (S ) -#define DEBUGOUT1(S, A...) -#endif - -#define DEBUGFUNC (F ) DEBUGOUT(F "\n") -#define DEBUGOUT2 DEBUGOUT1 -#define DEBUGOUT3 DEBUGOUT2 -#define DEBUGOUT7 DEBUGOUT3 - +#define ENTER () pr_debug("%s\n", __func__)#define er32 (reg) \ (readl(hw->hw_addr + ((hw->mac_type >= e1000_82543) \
drivers/net/e1000/e1000_param.c +66 -55
242 lines not on this page · raw message
Signature · 14 lines
1.7.0.14.g7e948 ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ E1000-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/e1000-devel To learn more about Intel® Ethernet, visit http://communities.intel.com/community/wired
PATCH 6/7 drivers/net/e1000e: Use pr_<level> and netdev_<level>
In reply to Joe PerchesConvert e_<level> to netdev_<level>
Remove #define PFX
Use #define pr_fmt
Convert a few printks to pr_<level>
Coalesce long formats
Typo spelling fix
--- drivers/net/e1000e/82571.c | 57 +++++++++++------- drivers/net/e1000e/e1000.h | 21 ------- drivers/net/e1000e/es2lan.c | 27 +++++---- drivers/net/e1000e/ethtool.c | 37 ++++++------ drivers/net/e1000e/ich8lan.c | 90 +++++++++++++++++------------ drivers/net/e1000e/lib.c | 131 +++++++++++++++++++++--------------------- drivers/net/e1000e/netdev.c | 95 +++++++++++++++--------------- drivers/net/e1000e/param.c | 20 +++--- drivers/net/e1000e/phy.c | 114 ++++++++++++++++++------------------ 9 files changed, 302 insertions(+), 290 deletions(-)
drivers/net/e1000e/82571.c +35 -22
@@ -317,13 +317,14 @@ static s32 e1000_init_mac_params_82571(struct e1000_adapter *adapter)* indicates that the bootagent or EFI code has * improperly left this bit enabled */ -e_dbg ("Please update your 82571 Bootagent\n" ); +netdev_dbg (adapter->netdev, +"Please update your 82571 Bootagent\n" ); }ew32 (SWSM , swsm & ~E1000_SWSM_SMBI ); }/* -* Initialze device specific counter of SMBI acquisition +* Initialize device specific counter of SMBI acquisition * timeouts. */ hw->dev_spec.e82571.smb_counter =0 ;
@@ -491,7 +492,8 @@ static s32 e1000_get_hw_semaphore_82571(struct e1000_hw *hw) }if (i == sw_timeout) { -e_dbg ("Driver can't access device - SMBI bit is set.\n" ); +netdev_dbg (hw->adapter->netdev, +"Driver can't access device - SMBI bit is set\n" ); hw->dev_spec.e82571.smb_counter++; }/* Get the FW semaphore. */
@@ -509,7 +511,7 @@ static s32 e1000_get_hw_semaphore_82571(struct e1000_hw *hw)if (i == fw_timeout) {/* Release semaphores */ e1000_put_hw_semaphore_82571 (hw); -e_dbg ("Driver can't access the NVM\n" ); +netdev_dbg (hw->adapter->netdev,"Driver can't access the NVM\n" );return -E1000_ERR_NVM ; }
@@ -715,7 +717,8 @@ static s32 e1000_write_nvm_eewr_82571(struct e1000_hw *hw, u16 offset,*/ if ((offset >= nvm->word_size) || (words > (nvm->word_size - offset)) || (words ==0 )) { -e_dbg ("nvm parameter(s) out of bounds\n" ); +netdev_dbg (hw->adapter->netdev, +"nvm parameter(s) out of bounds\n" );return -E1000_ERR_NVM ; }
@@ -756,7 +759,8 @@ static s32 e1000_get_cfg_done_82571(struct e1000_hw *hw) timeout--; }if (!timeout) { -e_dbg ("MNG configuration cycle has not completed.\n" ); +netdev_dbg (hw->adapter->netdev, +"MNG configuration cycle has not completed\n" );return -E1000_ERR_RESET ; }
@@ -851,9 +855,10 @@ static s32 e1000_reset_hw_82571(struct e1000_hw *hw)*/ ret_val =e1000e_disable_pcie_master (hw);if (ret_val) -e_dbg ("PCI-E Master disable polling has failed.\n" ); +netdev_dbg (hw->adapter->netdev, +"PCI-E Master disable polling has failed\n" ); -e_dbg ("Masking off all interrupts\n" ); +netdev_dbg (hw->adapter->netdev,"Masking off all interrupts\n" );ew32 (IMC ,0xffffffff );ew32 (RCTL ,0 );
@@ -892,7 +897,7 @@ static s32 e1000_reset_hw_82571(struct e1000_hw *hw) ctrl =er32 (CTRL ); -e_dbg ("Issuing a global reset to MAC\n" ); +netdev_dbg (hw->adapter->netdev,"Issuing a global reset to MAC\n" );ew32 (CTRL , ctrl |E1000_CTRL_RST );if (hw->nvm.type == e1000_nvm_flash_hw) {
@@ -960,11 +965,12 @@ static s32 e1000_init_hw_82571(struct e1000_hw *hw)/* Initialize identification LED */ ret_val =e1000e_id_led_init (hw);if (ret_val) -e_dbg ("Error initializing identification LED\n" ); +netdev_dbg (hw->adapter->netdev, +"Error initializing identification LED\n" );/* This is not fatal and we should not stop init due to this */ /* Disabling VLAN filtering */ -e_dbg ("Initializing the IEEE VLAN\n" ); +netdev_dbg (hw->adapter->netdev,"Initializing the IEEE VLAN\n" ); mac->ops.clear_vfta (hw);/* Setup the receive address. */
@@ -978,7 +984,7 @@ static s32 e1000_init_hw_82571(struct e1000_hw *hw)e1000e_init_rx_addrs (hw, rar_count);/* Zero out the Multicast HASH table */ -e_dbg ("Zeroing the MTA\n" ); +netdev_dbg (hw->adapter->netdev,"Zeroing the MTA\n" );for (i =0 ; i < mac->mta_reg_count; i++)E1000_WRITE_REG_ARRAY (hw,E1000_MTA , i,0 );
@@ -1375,7 +1381,8 @@ static s32 e1000_check_for_serdes_link_82571(struct e1000_hw *hw) mac->serdes_link_state = e1000_serdes_link_autoneg_progress; mac->serdes_has_link = false; -e_dbg ("AN_UP -> AN_PROG\n" ); +netdev_dbg (hw->adapter->netdev, +"AN_UP -> AN_PROG\n" ); }break ;
@@ -1393,7 +1400,8 @@ static s32 e1000_check_for_serdes_link_82571(struct e1000_hw *hw) mac->serdes_link_state = e1000_serdes_link_autoneg_progress; mac->serdes_has_link = false; -e_dbg ("FORCED_UP -> AN_PROG\n" ); +netdev_dbg (hw->adapter->netdev, +"FORCED_UP -> AN_PROG\n" ); }break ;
@@ -1407,13 +1415,15 @@ static s32 e1000_check_for_serdes_link_82571(struct e1000_hw *hw)if (status &E1000_STATUS_LU ) { mac->serdes_link_state = e1000_serdes_link_autoneg_complete; -e_dbg ("AN_PROG -> AN_UP\n" ); +netdev_dbg (hw->adapter->netdev, +"AN_PROG -> AN_UP\n" ); mac->serdes_has_link = true; }else {/* Autoneg completed, but failed. */ mac->serdes_link_state = e1000_serdes_link_down; -e_dbg ("AN_PROG -> DOWN\n" ); +netdev_dbg (hw->adapter->netdev, +"AN_PROG -> DOWN\n" ); } }else {/*
@@ -1428,13 +1438,15 @@ static s32 e1000_check_for_serdes_link_82571(struct e1000_hw *hw)/* Configure Flow Control after link up. */ ret_val =e1000e_config_fc_after_link_up (hw);if (ret_val) { -e_dbg ("Error config flow control\n" ); +netdev_dbg (hw->adapter->netdev, +"Error config flow control\n" );break ; } mac->serdes_link_state = e1000_serdes_link_forced_up; mac->serdes_has_link = true; -e_dbg ("AN_PROG -> FORCED_UP\n" ); +netdev_dbg (hw->adapter->netdev, +"AN_PROG -> FORCED_UP\n" ); }break ;
@@ -1449,14 +1461,14 @@ static s32 e1000_check_for_serdes_link_82571(struct e1000_hw *hw)ew32 (CTRL , (ctrl & ~E1000_CTRL_SLU )); mac->serdes_link_state = e1000_serdes_link_autoneg_progress; -e_dbg ("DOWN -> AN_PROG\n" ); +netdev_dbg (hw->adapter->netdev,"DOWN -> AN_PROG\n" );break ; } }else {if (!(rxcw &E1000_RXCW_SYNCH )) { mac->serdes_has_link = false; mac->serdes_link_state = e1000_serdes_link_down; -e_dbg ("ANYSTATE -> DOWN\n" ); +netdev_dbg (hw->adapter->netdev,"ANYSTATE -> DOWN\n" ); }else {/* * We have sync, and can tolerate one invalid (IV)
@@ -1468,7 +1480,8 @@ static s32 e1000_check_for_serdes_link_82571(struct e1000_hw *hw)if (rxcw &E1000_RXCW_IV ) { mac->serdes_link_state = e1000_serdes_link_down; mac->serdes_has_link = false; -e_dbg ("ANYSTATE -> DOWN\n" ); +netdev_dbg (hw->adapter->netdev, +"ANYSTATE -> DOWN\n" ); } } }
@@ -1490,7 +1503,7 @@ static s32 e1000_valid_led_default_82571(struct e1000_hw *hw, u16 *data) ret_val =e1000_read_nvm (hw,NVM_ID_LED_SETTINGS ,1 , data);if (ret_val) { -e_dbg ("NVM Read Error\n" ); +netdev_dbg (hw->adapter->netdev,"NVM Read Error\n" );return ret_val; }
drivers/net/e1000e/e1000.h +0 -21
@@ -42,27 +42,6 @@struct e1000_info ; -#define e_printk(level, adapter, format, arg...) \ - printk(level "%s: %s: " format, pci_name(adapter->pdev), \ - adapter->netdev->name, ## arg) - -#ifdef DEBUG -#define e_dbg(format, arg...) \ - e_printk(KERN_DEBUG , hw->adapter, format, ## arg) -#else -#define e_dbg(format, arg...) do { (void)(hw); } while (0) -#endif - -#define e_err(format, arg...) \ - e_printk(KERN_ERR, adapter, format, ## arg) -#define e_info(format, arg...) \ - e_printk(KERN_INFO, adapter, format, ## arg) -#define e_warn(format, arg...) \ - e_printk(KERN_WARNING, adapter, format, ## arg) -#define e_notice(format, arg...) \ - e_printk(KERN_NOTICE, adapter, format, ## arg) - -/* Interrupt modes, as used by the IntMode parameter */ #define E1000E_INT_MODE_LEGACY 0#define E1000E_INT_MODE_MSI 1
drivers/net/e1000e/es2lan.c +15 -12
@@ -399,7 +399,8 @@ static s32 e1000_acquire_swfw_sync_80003es2lan(struct e1000_hw *hw, u16 mask) }if (i == timeout) { -e_dbg ("Driver can't access resource, SW_FW_SYNC timeout.\n" ); +netdev_dbg (hw->adapter->netdev, +"Driver can't access resource, SW_FW_SYNC timeout\n" );return -E1000_ERR_SWFW_SYNC ; }
@@ -613,7 +614,8 @@ static s32 e1000_get_cfg_done_80003es2lan(struct e1000_hw *hw) timeout--; }if (!timeout) { -e_dbg ("MNG configuration cycle has not completed.\n" ); +netdev_dbg (hw->adapter->netdev, +"MNG configuration cycle has not completed\n" );return -E1000_ERR_RESET ; }
@@ -646,7 +648,7 @@ static s32 e1000_phy_force_speed_duplex_80003es2lan(struct e1000_hw *hw)if (ret_val)return ret_val; -e_dbg ("GG82563 PSCR: %X\n" , phy_data); +netdev_dbg (hw->adapter->netdev,"GG82563 PSCR: %X\n" , phy_data); ret_val =e1e_rphy (hw,PHY_CONTROL , &phy_data);if (ret_val)
@@ -664,8 +666,8 @@ static s32 e1000_phy_force_speed_duplex_80003es2lan(struct e1000_hw *hw)udelay (1 );if (hw->phy.autoneg_wait_to_complete) { -e_dbg ("Waiting for forced speed/duplex link " -"on GG82563 phy.\n" ); +netdev_dbg (hw->adapter->netdev, +"Waiting for forced speed/duplex link on GG82563 phy\n" ); ret_val =e1000e_phy_has_link_generic (hw,PHY_FORCE_LIMIT ,100000 , &link);
@@ -790,9 +792,10 @@ static s32 e1000_reset_hw_80003es2lan(struct e1000_hw *hw)*/ ret_val =e1000e_disable_pcie_master (hw);if (ret_val) -e_dbg ("PCI-E Master disable polling has failed.\n" ); +netdev_dbg (hw->adapter->netdev, +"PCI-E Master disable polling has failed\n" ); -e_dbg ("Masking off all interrupts\n" ); +netdev_dbg (hw->adapter->netdev,"Masking off all interrupts\n" );ew32 (IMC ,0xffffffff );ew32 (RCTL ,0 );
@@ -804,7 +807,7 @@ static s32 e1000_reset_hw_80003es2lan(struct e1000_hw *hw) ctrl =er32 (CTRL ); ret_val =e1000_acquire_phy_80003es2lan (hw); -e_dbg ("Issuing a global reset to MAC\n" ); +netdev_dbg (hw->adapter->netdev,"Issuing a global reset to MAC\n" );ew32 (CTRL , ctrl |E1000_CTRL_RST );e1000_release_phy_80003es2lan (hw);
@@ -840,18 +843,18 @@ static s32 e1000_init_hw_80003es2lan(struct e1000_hw *hw)/* Initialize identification LED */ ret_val =e1000e_id_led_init (hw);if (ret_val) -e_dbg ("Error initializing identification LED\n" ); +netdev_dbg (hw->adapter->netdev,"Error initializing identification LED\n" );/* This is not fatal and we should not stop init due to this */ /* Disabling VLAN filtering */ -e_dbg ("Initializing the IEEE VLAN\n" ); +netdev_dbg (hw->adapter->netdev,"Initializing the IEEE VLAN\n" ); mac->ops.clear_vfta (hw);/* Setup the receive address. */ e1000e_init_rx_addrs (hw, mac->rar_entry_count);/* Zero out the Multicast HASH table */ -e_dbg ("Zeroing the MTA\n" ); +netdev_dbg (hw->adapter->netdev,"Zeroing the MTA\n" );for (i =0 ; i < mac->mta_reg_count; i++)E1000_WRITE_REG_ARRAY (hw,E1000_MTA , i,0 );
@@ -1021,7 +1024,7 @@ static s32 e1000_copper_link_setup_gg82563_80003es2lan(struct e1000_hw *hw)/* SW Reset the PHY so all changes take effect */ ret_val =e1000e_commit_phy (hw);if (ret_val) { -e_dbg ("Error Resetting the PHY\n" ); +netdev_dbg (hw->adapter->netdev,"Error Resetting the PHY\n" );return ret_val; }
drivers/net/e1000e/ethtool.c +19 -18
@@ -214,7 +214,7 @@ static int e1000_set_spd_dplx(struct e1000_adapter *adapter, u16 spddplx)/* Fiber NICs only allow 1000 gbps Full duplex */ if ((adapter->hw.phy.media_type == e1000_media_type_fiber) && spddplx != (SPEED_1000 +DUPLEX_FULL )) { -e_err ("Unsupported Speed/Duplex configuration\n" ); +netdev_err (adapter->netdev,"Unsupported Speed/Duplex configuration\n" );return -EINVAL ; }
@@ -237,7 +237,7 @@ static int e1000_set_spd_dplx(struct e1000_adapter *adapter, u16 spddplx)break ;case SPEED_1000 +DUPLEX_HALF :/* not supported */ default : -e_err ("Unsupported Speed/Duplex configuration\n" ); +netdev_err (adapter->netdev,"Unsupported Speed/Duplex configuration\n" );return -EINVAL ; }return 0 ;
@@ -254,8 +254,7 @@ static int e1000_set_settings(struct net_device *netdev,* cannot be changed */ if (e1000_check_reset_block (hw)) { -e_err ("Cannot change link characteristics when SoL/IDER is " -"active.\n" ); +netdev_err (adapter->netdev,"Cannot change link characteristics when SoL/IDER is active\n" );return -EINVAL ; }
@@ -411,7 +410,7 @@ static int e1000_set_tso(struct net_device *netdev, u32 data) netdev->features &= ~NETIF_F_TSO6 ; } -e_info ("TSO is %s\n" , data ?"Enabled" :"Disabled" ); +netdev_info (adapter->netdev,"TSO is %s\n" , data ?"Enabled" :"Disabled" ); adapter->flags |=FLAG_TSO_FORCE ;return 0 ; }
@@ -768,9 +767,9 @@ static bool reg_pattern_test(struct e1000_adapter *adapter, u64 *data, (test[pat] & write)); val =E1000_READ_REG_ARRAY (&adapter->hw, reg, offset);if (val != (test[pat] & write & mask)) { -e_err ("pattern test reg %04X failed: got 0x%08X " -"expected 0x%08X\n" , reg + offset, val, - (test[pat] & write & mask)); +netdev_err (adapter->netdev,"pattern test reg %04X failed: got 0x%08X expected 0x%08X\n" , + reg + offset, val, + (test[pat] & write & mask)); *data = reg;return 1 ; }
@@ -785,8 +784,8 @@ static bool reg_set_and_check(struct e1000_adapter *adapter, u64 *data,__ew32 (&adapter->hw, reg, write & mask); val =__er32 (&adapter->hw, reg);if ((write & mask) != (val & mask)) { -e_err ("set/check reg %04X test failed: got 0x%08X " -"expected 0x%08X\n" , reg, (val & mask), (write & mask)); +netdev_err (adapter->netdev,"set/check reg %04X test failed: got 0x%08X expected 0x%08X\n" , + reg, (val & mask), (write & mask)); *data = reg;return 1 ; }
@@ -838,8 +837,9 @@ static int e1000_reg_test(struct e1000_adapter *adapter, u64 *data)ew32 (STATUS , toggle); after =er32 (STATUS ) & toggle;if (value != after) { -e_err ("failed STATUS register test got: 0x%08X expected: " -"0x%08X\n" , after, value); +netdev_err (adapter->netdev, +"failed STATUS register test got: 0x%08X expected: 0x%08X\n" , + after, value); *data =1 ;return 1 ; }
@@ -960,7 +960,8 @@ static int e1000_intr_test(struct e1000_adapter *adapter, u64 *data) ret_val =-1 ; goto out; } -e_info ("testing %s interrupt\n" , (shared_int ?"shared" :"unshared" )); +netdev_info (adapter->netdev,"testing %s interrupt\n" , + shared_int ?"shared" :"unshared" );/* Disable all the interrupts */ ew32 (IMC ,0xFFFFFFFF );
@@ -1604,7 +1605,7 @@ static int e1000_loopback_test(struct e1000_adapter *adapter, u64 *data)* sessions are active */ if (e1000_check_reset_block (&adapter->hw)) { -e_err ("Cannot do PHY loopback test when SoL/IDER is active.\n" ); +netdev_err (adapter->netdev,"Cannot do PHY loopback test when SoL/IDER is active\n" ); *data =0 ; goto out; }
@@ -1689,7 +1690,7 @@ static void e1000_diag_test(struct net_device *netdev, forced_speed_duplex = adapter->hw.mac.forced_speed_duplex; autoneg = adapter->hw.mac.autoneg; -e_info ("offline testing starting\n" ); +netdev_info (adapter->netdev,"offline testing starting\n" );/* * Link test performed before hardware reset so autoneg doesn't
@@ -1735,7 +1736,7 @@ static void e1000_diag_test(struct net_device *netdev,if (if_running)dev_open (netdev); }else { -e_info ("online testing starting\n" ); +netdev_info (adapter->netdev,"online testing starting\n" );/* Online tests */ if (e1000_link_test (adapter, &data[4 ])) eth_test->flags |=ETH_TEST_FL_FAILED ;
@@ -1772,8 +1773,8 @@ static void e1000_get_wol(struct net_device *netdev, wol->supported &= ~WAKE_UCAST ;if (adapter->wol &E1000_WUFC_EX ) -e_err ("Interface does not support directed (unicast) " -"frame wake-up packets\n" ); +netdev_err (adapter->netdev, +"Interface does not support directed (unicast) frame wake-up packets\n" ); }if (adapter->wol &E1000_WUFC_EX )
drivers/net/e1000e/ich8lan.c +54 -36
272 lines not on this page · raw message
drivers/net/e1000e/lib.c +65 -66
469 lines not on this page · raw message
drivers/net/e1000e/netdev.c +47 -48
348 lines not on this page · raw message
drivers/net/e1000e/param.c +10 -10
@@ -191,16 +191,16 @@ static int __devinit e1000_validate_option(unsigned int *value,case enable_option:switch (*value) {case OPTION_ENABLED : -e_info ("%s Enabled\n" , opt->name); +netdev_info (adapter->netdev,"%s Enabled\n" , opt->name);return 0 ;case OPTION_DISABLED : -e_info ("%s Disabled\n" , opt->name); +netdev_info (adapter->netdev,"%s Disabled\n" , opt->name);return 0 ; }break ;case range_option:if (*value >= opt->arg.r.min && *value <= opt->arg.r.max) { -e_info ("%s set to %i\n" , opt->name, *value); +netdev_info (adapter->netdev,"%s set to %i\n" , opt->name, *value);return 0 ; }break ;
@@ -212,7 +212,7 @@ static int __devinit e1000_validate_option(unsigned int *value, ent = &opt->arg.l.p[i];if (*value == ent->i) {if (ent->str[0 ] !='\0' ) -e_info ("%s\n" , ent->str); +netdev_info (adapter->netdev,"%s\n" , ent->str);return 0 ; } }
@@ -222,7 +222,7 @@ static int __devinit e1000_validate_option(unsigned int *value,BUG (); } -e_info ("Invalid %s value specified (%i) %s\n" , opt->name, *value, +netdev_info (adapter->netdev,"Invalid %s value specified (%i) %s\n" , opt->name, *value, opt->err); *value = opt->def;return -1 ;
@@ -243,8 +243,8 @@ void __devinit e1000e_check_options(struct e1000_adapter *adapter)int bd = adapter->bd_number;if (bd >=E1000_MAX_NIC ) { -e_notice ("Warning: no configuration for board #%i\n" , bd); -e_notice ("Using defaults for all values\n" ); +netdev_notice (adapter->netdev,"Warning: no configuration for board #%i\n" , bd); +netdev_notice (adapter->netdev,"Using defaults for all values\n" ); } {/* Transmit Interrupt Delay */
@@ -338,15 +338,15 @@ void __devinit e1000e_check_options(struct e1000_adapter *adapter) adapter->itr = InterruptThrottleRate[bd];switch (adapter->itr) {case 0 : -e_info ("%s turned off\n" , opt.name); +netdev_info (adapter->netdev,"%s turned off\n" , opt.name);break ;case 1 : -e_info ("%s set to dynamic mode\n" , opt.name); +netdev_info (adapter->netdev,"%s set to dynamic mode\n" , opt.name); adapter->itr_setting = adapter->itr; adapter->itr =20000 ;break ;case 3 : -e_info ("%s set to dynamic conservative mode\n" , +netdev_info (adapter->netdev,"%s set to dynamic conservative mode\n" , opt.name); adapter->itr_setting = adapter->itr; adapter->itr =20000 ;
drivers/net/e1000e/phy.c +57 -57
414 lines not on this page · raw message
Signature · 14 lines
1.7.0.14.g7e948 ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ E1000-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/e1000-devel To learn more about Intel® Ethernet, visit http://communities.intel.com/community/wired
RE: [PATCH net-next 6/7] drivers/net/e1000e: Use pr_<level> and netdev_<level>
Quoted 17 lines · Joe Perches
Convert e_<level> to netdev_<level>
Remove #define PFX
Use #definepr_fmt
Convert a few printks to pr_<level>
Coalesce long formats
Typo spelling fixSigned-off-by Joe Perches <[email protected]>--- drivers/net/e1000e/82571.c | 57 +++++++++++------- drivers/net/e1000e/e1000.h | 21 ------- drivers/net/e1000e/es2lan.c | 27 +++++---- drivers/net/e1000e/ethtool.c | 37 ++++++------ drivers/net/e1000e/ich8lan.c | 90 +++++++++++++++++------------ drivers/net/e1000e/lib.c | 131 +++++++++++++++++++++--------------------- drivers/net/e1000e/netdev.c | 95 +++++++++++++++---------------
Quoted 4 lines
drivers/net/e1000e/param.c| 20 +++---drivers/net/e1000e/phy.c
| 114 ++++++++++++++++++------------------ 9 files changed, 302
insertions(+), 290 deletions(-)
As an alternative to Joe's large patch to e1000e, I would like to suggest the following much less intrusive patch. Compile-tested only.
Convert e_<level> to netdev_<level>
Use #define pr_fmt
Convert a few printks to pr_<level>
--- drivers/net/e1000e/e1000.h | 19 +++++-------------- drivers/net/e1000e/netdev.c | 9 +++++---- 2 files changed, 10 insertions(+), 18 deletions(-)
drivers/net/e1000e/e1000.h +5 -14
@@ -42,25 +42,16 @@struct e1000_info ; -#define e_printk(level, adapter, format, arg...) \ - printk(level "%s: %s: " format, pci_name(adapter->pdev), \ - adapter->netdev->name, ## arg) - -#ifdef DEBUG #define e_dbg(format, arg...) \ - e_printk(KERN_DEBUG , hw->adapter, format, ## arg) -#else -#define e_dbg(format, arg...) do { (void)(hw); } while (0) -#endif - + netdev_dbg(hw->adapter->netdev, format, ## arg) #define e_err(format, arg...) \ - e_printk(KERN_ERR, adapter, format, ## arg) + netdev_err(adapter->netdev, format, ## arg) #define e_info(format, arg...) \ - e_printk(KERN_INFO, adapter, format, ## arg) + netdev_info(adapter->netdev, format, ## arg) #define e_warn(format, arg...) \ - e_printk(KERN_WARNING, adapter, format, ## arg) + netdev_warn(adapter->netdev, format, ## arg) #define e_notice(format, arg...) \ - e_printk(KERN_NOTICE, adapter, format, ## arg) + netdev_notice(adapter->netdev, format, ## arg)/* Interrupt modes, as used by the IntMode parameter */
drivers/net/e1000e/netdev.c +5 -4
@@ -26,6 +26,8 @@*******************************************************************************/ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/module.h> #include <linux/types.h> #include <linux/init.h>
@@ -5403,10 +5405,9 @@ static struct pci_driver e1000_driver = {static int __init e1000_init_module (void ) {int ret; -printk (KERN_INFO "%s: Intel(R) PRO/1000 Network Driver - %s\n" , - e1000e_driver_name, e1000e_driver_version); -printk (KERN_INFO "%s: Copyright (c) 1999 - 2009 Intel Corporation.\n" , - e1000e_driver_name); +pr_info ("Intel(R) PRO/1000 Network Driver - %s\n" , + e1000e_driver_version); +pr_info ("Copyright (c) 1999 - 2009 Intel Corporation.\n" ); ret =pci_register_driver (&e1000_driver);return ret;
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
E1000-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/e1000-devel
To learn more about Intel® Ethernet, visit http://communities.intel.com/community/wired
PATCH 7/7 drivers/net/igb: Use netdev_<level>
In reply to Joe PerchesConvert hw_dbg to netdev_dbg
Convert a couple printks to pr_<level>
Coalesce some format strings
--- drivers/net/igb/e1000_82575.c | 58 ++++++++++++----------- drivers/net/igb/e1000_hw.h | 12 ++--- drivers/net/igb/e1000_mac.c | 84 ++++++++++++++++----------------- drivers/net/igb/e1000_nvm.c | 22 ++++---- drivers/net/igb/e1000_phy.c | 104 +++++++++++++++++++++-------------------- drivers/net/igb/igb.h | 1 - drivers/net/igb/igb_ethtool.c | 6 +-- drivers/net/igb/igb_main.c | 43 ++++++----------- 8 files changed, 157 insertions(+), 173 deletions(-)
drivers/net/igb/e1000_82575.c +31 -27
@@ -33,8 +33,7 @@#include <linux/slab.h> #include <linux/if_ether.h> -#include "e1000_mac.h" -#include "e1000_82575.h" +#include "igb.h" static s32 igb_get_invariants_82575 (struct e1000_hw *);static s32 igb_acquire_phy_82575 (struct e1000_hw *);
@@ -322,7 +321,8 @@ static s32 igb_read_phy_reg_sgmii_82575(struct e1000_hw *hw, u32 offset,s32 ret_val = -E1000_ERR_PARAM ;if (offset >E1000_MAX_SGMII_PHY_REG_ADDR ) { -hw_dbg ("PHY Address %u is out of range\n" , offset); +netdev_dbg (hw_netdev (hw),"PHY Address %u is out of range\n" , + offset); goto out; }
@@ -354,7 +354,8 @@ static s32 igb_write_phy_reg_sgmii_82575(struct e1000_hw *hw, u32 offset,if (offset >E1000_MAX_SGMII_PHY_REG_ADDR ) { -hw_dbg ("PHY Address %d is out of range\n" , offset); +netdev_dbg (hw_netdev (hw),"PHY Address %d is out of range\n" , + offset); goto out; }
@@ -410,8 +411,8 @@ static s32 igb_get_phy_id_82575(struct e1000_hw *hw)for (phy->addr =1 ; phy->addr <8 ; phy->addr++) { ret_val =igb_read_phy_reg_sgmii_82575 (hw,PHY_ID1 , &phy_id);if (ret_val ==0 ) { -hw_dbg ("Vendor ID 0x%08X read at address %u\n" , - phy_id, phy->addr); +netdev_dbg (hw_netdev (hw),"Vendor ID 0x%08X read at address %u\n" , + phy_id, phy->addr);/* * At the time of this writing, The M88 part is * the only supported SGMII PHY product.
@@ -419,7 +420,8 @@ static s32 igb_get_phy_id_82575(struct e1000_hw *hw)if (phy_id ==M88_VENDOR )break ; }else { -hw_dbg ("PHY address %u was unreadable\n" , phy->addr); +netdev_dbg (hw_netdev (hw),"PHY address %u was unreadable\n" , + phy->addr); } }
@@ -454,7 +456,7 @@ static s32 igb_phy_hw_reset_sgmii_82575(struct e1000_hw *hw)* available to us at this time. */ -hw_dbg ("Soft resetting SGMII attached PHY...\n" ); +netdev_dbg (hw_netdev (hw),"Soft resetting SGMII attached PHY...\n" );/* * SFP documentation requires the following to configure the SPF module
@@ -622,7 +624,7 @@ static s32 igb_acquire_swfw_sync_82575(struct e1000_hw *hw, u16 mask) }if (i == timeout) { -hw_dbg ("Driver can't access resource, SW_FW_SYNC timeout.\n" ); +netdev_dbg (hw_netdev (hw),"Driver can't access resource, SW_FW_SYNC timeout\n" ); ret_val = -E1000_ERR_SWFW_SYNC ; goto out; }
@@ -688,7 +690,7 @@ static s32 igb_get_cfg_done_82575(struct e1000_hw *hw) timeout--; }if (!timeout) -hw_dbg ("MNG configuration cycle has not completed.\n" ); +netdev_dbg (hw_netdev (hw),"MNG configuration cycle has not completed\n" );/* If EEPROM is not marked present, init the PHY manually */ if (((rd32(E1000_EECD) & E1000_EECD_PRES) == 0) &&
@@ -859,15 +861,15 @@ static s32 igb_reset_hw_82575(struct e1000_hw *hw)*/ ret_val =igb_disable_pcie_master (hw);if (ret_val) -hw_dbg ("PCI-E Master disable polling has failed.\n" ); +netdev_dbg (hw_netdev (hw),"PCI-E Master disable polling has failed\n" );/* set the completion timeout for interface */ ret_val =igb_set_pcie_completion_timeout (hw);if (ret_val) { -hw_dbg ("PCI-E Set completion timeout has failed.\n" ); +netdev_dbg (hw_netdev (hw),"PCI-E Set completion timeout has failed\n" ); } -hw_dbg ("Masking off all interrupts\n" ); +netdev_dbg (hw_netdev (hw),"Masking off all interrupts\n" );wr32 (E1000_IMC ,0xffffffff );wr32 (E1000_RCTL ,0 );
@@ -878,7 +880,7 @@ static s32 igb_reset_hw_82575(struct e1000_hw *hw) ctrl =rd32 (E1000_CTRL ); -hw_dbg ("Issuing a global reset to MAC\n" ); +netdev_dbg (hw_netdev (hw),"Issuing a global reset to MAC\n" );wr32 (E1000_CTRL , ctrl |E1000_CTRL_RST ); ret_val =igb_get_auto_rd_done (hw);
@@ -888,7 +890,7 @@ static s32 igb_reset_hw_82575(struct e1000_hw *hw)* return with an error. This can happen in situations * where there is no eeprom and prevents getting link. */ -hw_dbg ("Auto Read Done did not complete\n" ); +netdev_dbg (hw_netdev (hw),"Auto Read Done did not complete\n" ); }/* If EEPROM is not present, run manual init scripts */
@@ -920,24 +922,24 @@ static s32 igb_init_hw_82575(struct e1000_hw *hw)/* Initialize identification LED */ ret_val =igb_id_led_init (hw);if (ret_val) { -hw_dbg ("Error initializing identification LED\n" ); +netdev_dbg (hw_netdev (hw),"Error initializing identification LED\n" );/* This is not fatal and we should not stop init due to this */ }/* Disabling VLAN filtering */ -hw_dbg ("Initializing the IEEE VLAN\n" ); +netdev_dbg (hw_netdev (hw),"Initializing the IEEE VLAN\n" );igb_clear_vfta (hw);/* Setup the receive address */ igb_init_rx_addrs (hw, rar_count);/* Zero out the Multicast HASH table */ -hw_dbg ("Zeroing the MTA\n" ); +netdev_dbg (hw_netdev (hw),"Zeroing the MTA\n" );for (i =0 ; i < mac->mta_reg_count; i++)array_wr32 (E1000_MTA , i,0 );/* Zero out the Unicast HASH table */ -hw_dbg ("Zeroing the UTA\n" ); +netdev_dbg (hw_netdev (hw),"Zeroing the UTA\n" );for (i =0 ; i < mac->uta_reg_count; i++)array_wr32 (E1000_UTA , i,0 );
@@ -983,7 +985,7 @@ static s32 igb_setup_copper_link_82575(struct e1000_hw *hw) ret_val = hw->phy.ops.reset (hw);if (ret_val) { -hw_dbg ("Error resetting the PHY.\n" ); +netdev_dbg (hw_netdev (hw),"Error resetting the PHY\n" ); goto out; } }
@@ -1104,12 +1106,14 @@ static s32 igb_setup_serdes_link_82575(struct e1000_hw *hw)/* Set PCS register for autoneg */ reg |=E1000_PCS_LCTL_AN_ENABLE |/* Enable Autoneg */ E1000_PCS_LCTL_AN_RESTART ;/* Restart autoneg */ -hw_dbg ("Configuring Autoneg:PCS_LCTL=0x%08X\n" , reg); +netdev_dbg (hw_netdev (hw),"Configuring Autoneg:PCS_LCTL=0x%08X\n" , + reg); }else {/* Set PCS register for forced link */ reg |=E1000_PCS_LCTL_FSD ;/* Force Speed */ -hw_dbg ("Configuring Forced Link:PCS_LCTL=0x%08X\n" , reg); +netdev_dbg (hw_netdev (hw),"Configuring Forced Link:PCS_LCTL=0x%08X\n" , + reg); }wr32 (E1000_PCS_LCTL , reg);
@@ -1144,7 +1148,7 @@ static bool igb_sgmii_active_82575(struct e1000_hw *hw)static s32 igb_reset_init_script_82575 (struct e1000_hw *hw) {if (hw->mac.type == e1000_82575) { -hw_dbg ("Running reset init script for 82575\n" ); +netdev_dbg (hw_netdev (hw),"Running reset init script for 82575\n" );/* SerDes configuration via SERDESCTRL */ igb_write_8bit_ctrl_reg (hw,E1000_SCTL ,0x00 ,0x0C );igb_write_8bit_ctrl_reg (hw,E1000_SCTL ,0x01 ,0x78 );
@@ -1307,7 +1311,7 @@ void igb_rx_fifo_flush_82575(struct e1000_hw *hw) }if (ms_wait ==10 ) -hw_dbg ("Queue disable timed out after 10ms\n" ); +netdev_dbg (hw_netdev (hw),"Queue disable timed out after 10ms\n" );/* Clear RLPML, RCTL.SBP, RFCTL.LEF, and set RCTL.LPE so that all * incoming packets are rejected. Set enable and wait 2ms so that
@@ -1532,9 +1536,9 @@ static s32 igb_reset_hw_82580(struct e1000_hw *hw)*/ ret_val =igb_disable_pcie_master (hw);if (ret_val) -hw_dbg ("PCI-E Master disable polling has failed.\n" ); +netdev_dbg (hw_netdev (hw),"PCI-E Master disable polling has failed\n" ); -hw_dbg ("Masking off all interrupts\n" ); +netdev_dbg (hw_netdev (hw),"Masking off all interrupts\n" );wr32 (E1000_IMC ,0xffffffff );wr32 (E1000_RCTL ,0 );wr32 (E1000_TCTL ,E1000_TCTL_PSP );
@@ -1566,7 +1570,7 @@ static s32 igb_reset_hw_82580(struct e1000_hw *hw)* return with an error. This can happen in situations * where there is no eeprom and prevents getting link. */ -hw_dbg ("Auto Read Done did not complete\n" ); +netdev_dbg (hw_netdev (hw),"Auto Read Done did not complete\n" ); }/* If EEPROM is not present, run manual init scripts */
drivers/net/igb/e1000_hw.h +5 -7
@@ -31,6 +31,7 @@#include <linux/types.h> #include <linux/delay.h> #include <linux/io.h> +#include <linux/netdevice.h> #include "e1000_regs.h" #include "e1000_defines.h"
@@ -501,14 +502,11 @@ struct e1000_hw { u8 revision_id; }; -#ifdef DEBUG -extern char *igb_get_hw_dev_name (struct e1000_hw *hw); -#define hw_dbg(format, arg...) \ - printk(KERN_DEBUG "%s: " format, igb_get_hw_dev_name(hw), ##arg) -#else -#define hw_dbg(format, arg...) -#endif +/* get (struct net_device *) from (struct e1000_hw *) */ +#define hw_netdev (hw) (((struct igb_adapter *)((hw)->back))->netdev) +#endif +/* These functions must be implemented by drivers */ s32 igb_read_pcie_cap_reg (struct e1000_hw *hw,u32 reg,u16 *value);s32 igb_write_pcie_cap_reg (struct e1000_hw *hw,u32 reg,u16 *value);
drivers/net/igb/e1000_mac.c +41 -43
260 lines not on this page · raw message
drivers/net/igb/e1000_nvm.c +11 -11
@@ -28,7 +28,7 @@#include <linux/if_ether.h> #include <linux/delay.h> -#include "e1000_mac.h" +#include "igb.h" #include "e1000_nvm.h" /**
@@ -200,7 +200,7 @@ s32 igb_acquire_nvm(struct e1000_hw *hw)if (!timeout) { eecd &= ~E1000_EECD_REQ ;wr32 (E1000_EECD , eecd); -hw_dbg ("Could not acquire NVM grant\n" ); +netdev_dbg (hw_netdev (hw),"Could not acquire NVM grant\n" ); ret_val = -E1000_ERR_NVM ; }
@@ -307,7 +307,7 @@ static s32 igb_ready_nvm_eeprom(struct e1000_hw *hw) }if (!timeout) { -hw_dbg ("SPI NVM Status error\n" ); +netdev_dbg (hw_netdev (hw),"SPI NVM Status error\n" ); ret_val = -E1000_ERR_NVM ; goto out; }
@@ -338,7 +338,7 @@ s32 igb_read_nvm_eerd(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)*/ if ((offset >= nvm->word_size) || (words > (nvm->word_size - offset)) || (words ==0 )) { -hw_dbg ("nvm parameter(s) out of bounds\n" ); +netdev_dbg (hw_netdev (hw),"nvm parameter(s) out of bounds\n" ); ret_val = -E1000_ERR_NVM ; goto out; }
@@ -384,7 +384,7 @@ s32 igb_write_nvm_spi(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)*/ if ((offset >= nvm->word_size) || (words > (nvm->word_size - offset)) || (words ==0 )) { -hw_dbg ("nvm parameter(s) out of bounds\n" ); +netdev_dbg (hw_netdev (hw),"nvm parameter(s) out of bounds\n" ); ret_val = -E1000_ERR_NVM ; goto out; }
@@ -459,14 +459,14 @@ s32 igb_read_part_num(struct e1000_hw *hw, u32 *part_num) ret_val = hw->nvm.ops.read (hw,NVM_PBA_OFFSET_0 ,1 , &nvm_data);if (ret_val) { -hw_dbg ("NVM Read Error\n" ); +netdev_dbg (hw_netdev (hw),"NVM Read Error\n" ); goto out; } *part_num = (u32)(nvm_data <<16 ); ret_val = hw->nvm.ops.read (hw,NVM_PBA_OFFSET_1 ,1 , &nvm_data);if (ret_val) { -hw_dbg ("NVM Read Error\n" ); +netdev_dbg (hw_netdev (hw),"NVM Read Error\n" ); goto out; } *part_num |= nvm_data;
@@ -520,14 +520,14 @@ s32 igb_validate_nvm_checksum(struct e1000_hw *hw)for (i =0 ; i < (NVM_CHECKSUM_REG +1 ); i++) { ret_val = hw->nvm.ops.read (hw, i,1 , &nvm_data);if (ret_val) { -hw_dbg ("NVM Read Error\n" ); +netdev_dbg (hw_netdev (hw),"NVM Read Error\n" ); goto out; } checksum += nvm_data; }if (checksum != (u16 )NVM_SUM ) { -hw_dbg ("NVM Checksum Invalid\n" ); +netdev_dbg (hw_netdev (hw),"NVM Checksum Invalid\n" ); ret_val = -E1000_ERR_NVM ; goto out; }
@@ -553,7 +553,7 @@ s32 igb_update_nvm_checksum(struct e1000_hw *hw)for (i =0 ; i <NVM_CHECKSUM_REG ; i++) { ret_val = hw->nvm.ops.read (hw, i,1 , &nvm_data);if (ret_val) { -hw_dbg ("NVM Read Error while updating checksum.\n" ); +netdev_dbg (hw_netdev (hw),"NVM Read Error while updating checksum\n" ); goto out; } checksum += nvm_data;
@@ -561,7 +561,7 @@ s32 igb_update_nvm_checksum(struct e1000_hw *hw) checksum = (u16 )NVM_SUM - checksum; ret_val = hw->nvm.ops.write (hw,NVM_CHECKSUM_REG ,1 , &checksum);if (ret_val) -hw_dbg ("NVM Write Error while updating checksum.\n" ); +netdev_dbg (hw_netdev (hw),"NVM Write Error while updating checksum\n" ); out:return ret_val;
drivers/net/igb/e1000_phy.c +53 -51
360 lines not on this page · raw message
drivers/net/igb/igb.h +0 -1
@@ -337,7 +337,6 @@ enum igb_boards {extern char igb_driver_name[];extern char igb_driver_version[]; -extern char *igb_get_hw_dev_name (struct e1000_hw *hw);extern int igb_up (struct igb_adapter *);extern void igb_down (struct igb_adapter *);extern void igb_reinit_locked (struct igb_adapter *);
drivers/net/igb/igb_ethtool.c +2 -4
@@ -200,8 +200,7 @@ static int igb_set_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)/* When SoL/IDER sessions are active, autoneg/speed/duplex * cannot be changed */ if (igb_check_reset_block (hw)) { -dev_err (&adapter->pdev->dev,"Cannot change link " -"characteristics when SoL/IDER is active.\n" ); +dev_err (&adapter->pdev->dev,"Cannot change link characteristics when SoL/IDER is active\n" );return -EINVAL ; }
@@ -1656,8 +1655,7 @@ static int igb_loopback_test(struct igb_adapter *adapter, u64 *data)* sessions are active */ if (igb_check_reset_block (&adapter->hw)) {dev_err (&adapter->pdev->dev, -"Cannot do PHY loopback test " -"when SoL/IDER is active.\n" ); +"Cannot do PHY loopback test when SoL/IDER is active\n" ); *data =0 ; goto out; }
drivers/net/igb/igb_main.c +14 -29
99 lines not on this page · raw message
Signature · 14 lines
1.7.0.14.g7e948 ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ E1000-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/e1000-devel To learn more about Intel® Ethernet, visit http://communities.intel.com/community/wired
Jeff Kirsher
AppliedQuoted 59 lines · Joe Perches
Some more conversions of drivers to:
netif_<level>
netdev_<level>
pr_<level>with some other minor updates/corrections
noticed during conversions.Joe Perches (7):
drivers/net/chelsio: Use pr_<level>, netif_msg_<type>drivers/net/myri10ge: Use pr_<level> and netdev_<level>drivers/net/ixgbe: Use pr_<level> and netif_<level>drivers/net/ixgb: Use pr_<level> and netdev_<level>drivers/net/e1000: Use pr_<level> and netif_<level>drivers/net/e1000e: Use pr_<level> and netdev_<level>drivers/net/igb: Use netdev_<level>drivers/net/chelsio/common.h | 24 +--
drivers/net/chelsio/cxgb2.c| 18 +-drivers/net/chelsio/espi.c| 4 +-drivers/net/chelsio/pm3393.c| 16 +-drivers/net/chelsio/sge.c| 10 +-drivers/net/chelsio/subr.c| 32 ++--drivers/net/chelsio/vsc7326.c| 24 ++--drivers/net/e1000/e1000.h| 17 --drivers/net/e1000/e1000_ethtool.c| 38 ++--drivers/net/e1000/e1000_hw.c| 383 ++++++++++++++++++-------------------drivers/net/e1000/e1000_main.c| 272 +++++++++++++-------------drivers/net/e1000/e1000_osdep.h| 14 +--drivers/net/e1000/e1000_param.c| 121 +++++++------drivers/net/e1000e/82571.c| 57 ++++--drivers/net/e1000e/e1000.h| 21 --drivers/net/e1000e/es2lan.c | 27 ++-- drivers/net/e1000e/ethtool.c | 37 ++-- drivers/net/e1000e/ich8lan.c | 90 +++++----drivers/net/e1000e/lib.c | 131 +++++++-------
drivers/net/e1000e/netdev.c| 95 +++++-----drivers/net/e1000e/param.c| 20 +-drivers/net/e1000e/phy.c| 114 ++++++------drivers/net/igb/e1000_82575.c| 58 +++---drivers/net/igb/e1000_hw.h| 12 +-drivers/net/igb/e1000_mac.c | 84 ++++---- drivers/net/igb/e1000_nvm.c | 22 +- drivers/net/igb/e1000_phy.c | 104 +++++-----drivers/net/igb/igb.h | 1 -
drivers/net/igb/igb_ethtool.c | 6 +-
drivers/net/igb/igb_main.c | 43 ++---
drivers/net/ixgb/ixgb.h | 8 +-drivers/net/ixgb/ixgb_ee.c | 14 +- drivers/net/ixgb/ixgb_hw.c | 147 ++++++--------- drivers/net/ixgb/ixgb_hw.h | 12 --drivers/net/ixgb/ixgb_main.c | 33 ++--
drivers/net/ixgb/ixgb_osdep.h | 16 +--
drivers/net/ixgb/ixgb_param.c | 31 ++--
drivers/net/ixgbe/ixgbe.h | 6 -
drivers/net/ixgbe/ixgbe_common.h | 15 +-
drivers/net/ixgbe/ixgbe_dcb_nl.c | 5 +-
drivers/net/ixgbe/ixgbe_ethtool.c | 40 +++--
Quoted 7 lines
drivers/net/ixgbe/ixgbe_fcoe.c | 25 ++-- drivers/net/ixgbe/ixgbe_main.c | 110 +++++------ drivers/net/ixgbe/ixgbe_phy.c | 2 + drivers/net/ixgbe/ixgbe_sriov.c | 11 +- drivers/net/myri10ge/myri10ge.c | 183 +++++++----------- 46 files changed, 1202 insertions(+), 1351 deletions(-)
I have applied patches 3-7 (the patches to Intel drivers) to my queue of patches for review and testing.
Signature · 14 lines
Cheers, Jeff ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ E1000-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/e1000-devel To learn more about Intel® Ethernet, visit http://communities.intel.com/community/wired
PATCH 1/1 drivers/net/e100.c: Use pr_<level> and netif_<level>
Convert DPRINTK, commonly used for debugging, to netif_<level> Remove #define PFX
Use #define pr_fmt
Consistently use no periods for non-sentence logging messages
--- drivers/net/e100.c | 183 ++++++++++++++++++++++++++++------------------------ 1 files changed, 98 insertions(+), 85 deletions(-)
drivers/net/e100.c +98 -85
@@ -147,6 +147,8 @@* - add clean lowlevel I/O emulation for cards with MII-lacking PHYs */ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/module.h> #include <linux/moduleparam.h> #include <linux/kernel.h>
@@ -174,7 +176,6 @@#define DRV_VERSION "3.5.24-k2"DRV_EXT#define DRV_DESCRIPTION "Intel(R) PRO/100 Network Driver"#define DRV_COPYRIGHT "Copyright(c) 1999-2006 Intel Corporation" -#define PFX DRV_NAME ": "#define E100_WATCHDOG_PERIOD (2 * HZ)#define E100_NAPI_WEIGHT 16
@@ -200,10 +201,6 @@ module_param(use_io, int, 0);MODULE_PARM_DESC (debug,"Debug level (0=none,...,16=all)" );MODULE_PARM_DESC (eeprom_bad_csum_allow,"Allow bad eeprom checksums" );MODULE_PARM_DESC (use_io,"Force use of i/o access mode" ); -#define DPRINTK(nlevel, klevel, fmt, args...) \ - (void)((NETIF_MSG_##nlevel & nic->msg_enable) && \ - printk(KERN_##klevel PFX "%s: %s: " fmt, nic->netdev->name, \ - __func__ , ## args))#define INTEL_8255X_ETHERNET_DEVICE (device_id, ich) {\ PCI_VENDOR_ID_INTEL, device_id, PCI_ANY_ID, PCI_ANY_ID, \
@@ -689,12 +686,13 @@ static int e100_self_test(struct nic *nic)/* Check results of self-test */ if (nic->mem->selftest.result !=0 ) { -DPRINTK (HW ,ERR ,"Self-test failed: result=0x%08X\n" , - nic->mem->selftest.result); +netif_err (nic, hw, nic->netdev, +"Self-test failed: result=0x%08X\n" , + nic->mem->selftest.result);return -ETIMEDOUT ; }if (nic->mem->selftest.signature ==0 ) { -DPRINTK (HW ,ERR ,"Self-test failed: timed out\n" ); +netif_err (nic, hw, nic->netdev,"Self-test failed: timed out\n" );return -ETIMEDOUT ; }
@@ -797,7 +795,7 @@ static int e100_eeprom_load(struct nic *nic)/* The checksum, stored in the last word, is calculated such that * the sum of words should be 0xBABA */ if (cpu_to_le16 (0xBABA - checksum) != nic->eeprom[nic->eeprom_wc -1 ]) { -DPRINTK (PROBE ,ERR ,"EEPROM corrupted\n" ); +netif_err (nic, probe, nic->netdev,"EEPROM corrupted\n" );if (!eeprom_bad_csum_allow)return -EAGAIN ; }
@@ -953,8 +951,7 @@ static u16 mdio_ctrl_hw(struct nic *nic, u32 addr, u32 dir, u32 reg, u16 data)udelay (20 ); }if (unlikely (!i)) { -printk ("e100.mdio_ctrl(%s) won't go Ready\n" , - nic->netdev->name ); +netdev_err (nic->netdev,"e100.mdio_ctrl won't go Ready\n" );spin_unlock_irqrestore (&nic->mdio_lock, flags);return 0 ;/* No way to indicate timeout error */ }
@@ -966,9 +963,10 @@ static u16 mdio_ctrl_hw(struct nic *nic, u32 addr, u32 dir, u32 reg, u16 data)break ; }spin_unlock_irqrestore (&nic->mdio_lock, flags); -DPRINTK (HW ,DEBUG , -"%s:addr=%d, reg=%d, data_in=0x%04X, data_out=0x%04X\n" , - dir == mdi_read ?"READ" :"WRITE" , addr, reg, data, data_out); +netif_printk (nic, hw,KERN_DEBUG , nic->netdev, +"%s:addr=%d, reg=%d, data_in=0x%04X, data_out=0x%04X\n" , + dir == mdi_read ?"READ" :"WRITE" , + addr, reg, data, data_out);return (u16 )data_out; }
@@ -1028,17 +1026,19 @@ static u16 mdio_ctrl_phy_mii_emulated(struct nic *nic,return ADVERTISE_10HALF |ADVERTISE_10FULL ;default : -DPRINTK (HW ,DEBUG , -"%s:addr=%d, reg=%d, data=0x%04X: unimplemented emulation!\n" , - dir == mdi_read ?"READ" :"WRITE" , addr, reg, data); +netif_printk (nic, hw,KERN_DEBUG , nic->netdev, +"%s:addr=%d, reg=%d, data=0x%04X: unimplemented emulation!\n" , + dir == mdi_read ?"READ" :"WRITE" , + addr, reg, data);return 0xFFFF ; } }else {switch (reg) {default : -DPRINTK (HW ,DEBUG , -"%s:addr=%d, reg=%d, data=0x%04X: unimplemented emulation!\n" , - dir == mdi_read ?"READ" :"WRITE" , addr, reg, data); +netif_printk (nic, hw,KERN_DEBUG , nic->netdev, +"%s:addr=%d, reg=%d, data=0x%04X: unimplemented emulation!\n" , + dir == mdi_read ?"READ" :"WRITE" , + addr, reg, data);return 0xFFFF ; } }
@@ -1155,12 +1155,15 @@ static void e100_configure(struct nic *nic, struct cb *cb, struct sk_buff *skb) } } -DPRINTK (HW ,DEBUG ,"[00-07]=%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X\n" , - c[0 ], c[1 ], c[2 ], c[3 ], c[4 ], c[5 ], c[6 ], c[7 ]); -DPRINTK (HW ,DEBUG ,"[08-15]=%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X\n" , - c[8 ], c[9 ], c[10 ], c[11 ], c[12 ], c[13 ], c[14 ], c[15 ]); -DPRINTK (HW ,DEBUG ,"[16-23]=%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X\n" , - c[16 ], c[17 ], c[18 ], c[19 ], c[20 ], c[21 ], c[22 ], c[23 ]); +netif_printk (nic, hw,KERN_DEBUG , nic->netdev, +"[00-07]=%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X\n" , + c[0 ], c[1 ], c[2 ], c[3 ], c[4 ], c[5 ], c[6 ], c[7 ]); +netif_printk (nic, hw,KERN_DEBUG , nic->netdev, +"[08-15]=%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X\n" , + c[8 ], c[9 ], c[10 ], c[11 ], c[12 ], c[13 ], c[14 ], c[15 ]); +netif_printk (nic, hw,KERN_DEBUG , nic->netdev, +"[16-23]=%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X\n" , + c[16 ], c[17 ], c[18 ], c[19 ], c[20 ], c[21 ], c[22 ], c[23 ]); }/*************************************************************************
@@ -1253,16 +1256,18 @@ static const struct firmware *e100_request_firmware(struct nic *nic) err =request_firmware (&fw, fw_name, &nic->pdev->dev);if (err) { -DPRINTK (PROBE ,ERR ,"Failed to load firmware \"%s\": %d\n" , - fw_name, err); +netif_err (nic, probe, nic->netdev, +"Failed to load firmware \"%s\": %d\n" , + fw_name, err);return ERR_PTR (err); }/* Firmware should be precisely UCODE_SIZE (words) plus three bytes indicating the offsets for BUNDLESMALL, BUNDLEMAX, INTDELAY */ if (fw->size !=UCODE_SIZE *4 +3 ) { -DPRINTK (PROBE ,ERR ,"Firmware \"%s\" has wrong size %zu\n" , - fw_name, fw->size); +netif_err (nic, probe, nic->netdev, +"Firmware \"%s\" has wrong size %zu\n" , + fw_name, fw->size);release_firmware (fw);return ERR_PTR (-EINVAL ); }
@@ -1274,9 +1279,9 @@ static const struct firmware *e100_request_firmware(struct nic *nic)if (timer >=UCODE_SIZE || bundle >=UCODE_SIZE || min_size >=UCODE_SIZE ) { -DPRINTK (PROBE ,ERR , -"\"%s\" has bogus offset values (0x%x,0x%x,0x%x)\n" , - fw_name, timer, bundle, min_size); +netif_err (nic, probe, nic->netdev, +"\"%s\" has bogus offset values (0x%x,0x%x,0x%x)\n" , + fw_name, timer, bundle, min_size);release_firmware (fw);return ERR_PTR (-EINVAL ); }
@@ -1328,7 +1333,8 @@ static inline int e100_load_ucode_wait(struct nic *nic)return PTR_ERR (fw);if ((err =e100_exec_cb (nic, (void *)fw, e100_setup_ucode))) -DPRINTK (PROBE ,ERR ,"ucode cmd failed with error %d\n" , err); +netif_err (nic, probe, nic->netdev, +"ucode cmd failed with error %d\n" , err);/* must restart cuc */ nic->cuc_cmd = cuc_start;
@@ -1348,7 +1354,7 @@ static inline int e100_load_ucode_wait(struct nic *nic)/* if the command failed, or is not OK, notify and return */ if (!counter || !(cb->status &cpu_to_le16 (cb_ok))) { -DPRINTK (PROBE ,ERR ,"ucode load failed\n" ); +netif_err (nic, probe, nic->netdev,"ucode load failed\n" ); err = -EPERM ; }
@@ -1386,8 +1392,8 @@ static int e100_phy_check_without_mii(struct nic *nic)* media is sensed automatically based on how the link partner * is configured. This is, in essence, manual configuration. */ -DPRINTK (PROBE ,INFO , -"found MII-less i82503 or 80c24 or other PHY\n" ); +netif_info (nic, probe, nic->netdev, +"found MII-less i82503 or 80c24 or other PHY\n" ); nic->mdio_ctrl = mdio_ctrl_phy_mii_emulated; nic->mii.phy_id =0 ;/* is this ok for an MII-less PHY? */
@@ -1434,18 +1440,20 @@ static int e100_phy_init(struct nic *nic)return 0 ;/* simply return and hope for the best */ else {/* for unknown cases log a fatal error */ -DPRINTK (HW ,ERR , -"Failed to locate any known PHY, aborting.\n" ); +netif_err (nic, hw, nic->netdev, +"Failed to locate any known PHY, aborting\n" );return -EAGAIN ; } }else -DPRINTK (HW ,DEBUG ,"phy_addr = %d\n" , nic->mii.phy_id); +netif_printk (nic, hw,KERN_DEBUG , nic->netdev, +"phy_addr = %d\n" , nic->mii.phy_id);/* Get phy ID */ id_lo =mdio_read (netdev, nic->mii.phy_id,MII_PHYSID1 ); id_hi =mdio_read (netdev, nic->mii.phy_id,MII_PHYSID2 ); nic->phy = (u32 )id_hi <<16 | (u32 )id_lo; -DPRINTK (HW ,DEBUG ,"phy ID = 0x%08X\n" , nic->phy); +netif_printk (nic, hw,KERN_DEBUG , nic->netdev, +"phy ID = 0x%08X\n" , nic->phy);/* Select the phy and isolate the rest */ for (addr =0 ; addr <32 ; addr++) {
@@ -1507,7 +1515,7 @@ static int e100_hw_init(struct nic *nic)e100_hw_reset (nic); -DPRINTK (HW ,ERR ,"e100_hw_init\n" ); +netif_err (nic, hw, nic->netdev,"e100_hw_init\n" );if (!in_interrupt () && (err =e100_self_test (nic)))return err;
@@ -1555,8 +1563,9 @@ static void e100_set_multicast_list(struct net_device *netdev) {struct nic *nic =netdev_priv (netdev); -DPRINTK (HW ,DEBUG ,"mc_count=%d, flags=0x%04X\n" , -netdev_mc_count (netdev), netdev->flags); +netif_printk (nic, hw,KERN_DEBUG , nic->netdev, +"mc_count=%d, flags=0x%04X\n" , +netdev_mc_count (netdev), netdev->flags);if (netdev->flags &IFF_PROMISC ) nic->flags |= promiscuous;
@@ -1629,7 +1638,8 @@ static void e100_update_stats(struct nic *nic)if (e100_exec_cmd (nic, cuc_dump_reset,0 )) -DPRINTK (TX_ERR ,DEBUG ,"exec cuc_dump_reset failed\n" ); +netif_printk (nic, tx_err,KERN_DEBUG , nic->netdev, +"exec cuc_dump_reset failed\n" ); }static void e100_adjust_adaptive_ifs (struct nic *nic,int speed,int duplex)
@@ -1659,20 +1669,19 @@ static void e100_watchdog(unsigned long data)struct nic *nic = (struct nic *)data;struct ethtool_cmd cmd; -DPRINTK (TIMER ,DEBUG ,"right now = %ld\n" , jiffies); +netif_printk (nic, timer,KERN_DEBUG , nic->netdev, +"right now = %ld\n" , jiffies);/* mii library handles link maintenance tasks */ mii_ethtool_gset (&nic->mii, &cmd);if (mii_link_ok (&nic->mii) && !netif_carrier_ok (nic->netdev)) { -printk (KERN_INFO "e100: %s NIC Link is Up %s Mbps %s Duplex\n" , - nic->netdev->name, - cmd.speed ==SPEED_100 ?"100" :"10" , - cmd.duplex ==DUPLEX_FULL ?"Full" :"Half" ); +netdev_info (nic->netdev,"NIC Link is Up %u Mbps %s Duplex\n" , + cmd.speed ==SPEED_100 ?100 :10 , + cmd.duplex ==DUPLEX_FULL ?"Full" :"Half" ); }else if (!mii_link_ok (&nic->mii) &&netif_carrier_ok (nic->netdev)) { -printk (KERN_INFO "e100: %s NIC Link is Down\n" , - nic->netdev->name); +netdev_info (nic->netdev,"NIC Link is Down\n" ); }mii_check_link (&nic->mii);
@@ -1732,7 +1741,8 @@ static netdev_tx_t e100_xmit_frame(struct sk_buff *skb,Issue a NOP command followed by a 1us delay before issuing the Tx command. */ if (e100_exec_cmd (nic, cuc_nop,0 )) -DPRINTK (TX_ERR ,DEBUG ,"exec cuc_nop failed\n" ); +netif_printk (nic, tx_err,KERN_DEBUG , nic->netdev, +"exec cuc_nop failed\n" );udelay (1 ); }
@@ -1741,12 +1751,14 @@ static netdev_tx_t e100_xmit_frame(struct sk_buff *skb,switch (err) {case -ENOSPC :/* We queued the skb, but now we're out of space. */ -DPRINTK (TX_ERR ,DEBUG ,"No space for CB\n" ); +netif_printk (nic, tx_err,KERN_DEBUG , nic->netdev, +"No space for CB\n" );netif_stop_queue (netdev);break ;case -ENOMEM :/* This is a hard error - log it. */ -DPRINTK (TX_ERR ,DEBUG ,"Out of Tx resources, returning skb\n" ); +netif_printk (nic, tx_err,KERN_DEBUG , nic->netdev, +"Out of Tx resources, returning skb\n" );netif_stop_queue (netdev);return NETDEV_TX_BUSY ; }
@@ -1767,9 +1779,10 @@ static int e100_tx_clean(struct nic *nic)for (cb = nic->cb_to_clean; cb->status &cpu_to_le16 (cb_complete); cb = nic->cb_to_clean = cb->next) { -DPRINTK (TX_DONE ,DEBUG ,"cb[%d]->status = 0x%04X\n" , - (int )(((void *)cb - (void *)nic->cbs)/sizeof (struct cb )), - cb->status); +netif_printk (nic, tx_done,KERN_DEBUG , nic->netdev, +"cb[%d]->status = 0x%04X\n" , + (int )(((void *)cb - (void *)nic->cbs)/sizeof (struct cb )), + cb->status);if (likely (cb->skb !=NULL )) { dev->stats.tx_packets++;
@@ -1912,7 +1925,8 @@ static int e100_rx_indicate(struct nic *nic, struct rx *rx, sizeof(struct rfd), PCI_DMA_BIDIRECTIONAL); rfd_status =le16_to_cpu (rfd->status); -DPRINTK (RX_STATUS ,DEBUG ,"status=0x%04X\n" , rfd_status); +netif_printk (nic, rx_status,KERN_DEBUG , nic->netdev, +"status=0x%04X\n" , rfd_status);/* If data isn't ready, nothing to indicate */ if (unlikely (!(rfd_status & cb_complete))) {
@@ -2123,7 +2137,8 @@ static irqreturn_t e100_intr(int irq, void *dev_id)struct nic *nic =netdev_priv (netdev);u8 stat_ack =ioread8 (&nic->csr->scb.stat_ack); -DPRINTK (INTR ,DEBUG ,"stat_ack = 0x%02X\n" , stat_ack); +netif_printk (nic, intr,KERN_DEBUG , nic->netdev, +"stat_ack = 0x%02X\n" , stat_ack);if (stat_ack == stat_ack_not_ours ||/* Not our interrupt */ stat_ack == stat_ack_not_present)/* Hardware is ejected */
@@ -2263,8 +2278,8 @@ static void e100_tx_timeout_task(struct work_struct *work) struct nic *nic = container_of(work, struct nic, tx_timeout_task);struct net_device *netdev = nic->netdev; -DPRINTK (TX_ERR ,DEBUG ,"scb.status=0x%02X\n" , -ioread8 (&nic->csr->scb.status)); +netif_printk (nic, tx_err,KERN_DEBUG , nic->netdev, +"scb.status=0x%02X\n" ,ioread8 (&nic->csr->scb.status));e100_down (netdev_priv (netdev));e100_up (netdev_priv (netdev)); }
@@ -2526,8 +2541,8 @@ static int e100_set_ringparam(struct net_device *netdev, rfds->count =min (rfds->count, rfds->max); cbs->count =max (ring->tx_pending, cbs->min); cbs->count =min (cbs->count, cbs->max); -DPRINTK (DRV ,INFO ,"Ring Param settings: rx: %d, tx %d\n" , - rfds->count, cbs->count); +netif_info (nic, drv, nic->netdev,"Ring Param settings: rx: %d, tx %d\n" , + rfds->count, cbs->count);if (netif_running (netdev))e100_up (nic);
@@ -2704,7 +2719,7 @@ static int e100_open(struct net_device *netdev)netif_carrier_off (netdev);if ((err =e100_up (nic))) -DPRINTK (IFUP ,ERR ,"Cannot open interface, aborting.\n" ); +netif_err (nic, ifup, nic->netdev,"Cannot open interface, aborting\n" );return err; }
@@ -2738,7 +2753,7 @@ static int __devinit e100_probe(struct pci_dev *pdev,if (!(netdev =alloc_etherdev (sizeof (struct nic )))) {if (((1 << debug) -1 ) &NETIF_MSG_PROBE ) - printk(KERN_ERR PFX "Etherdev alloc failed, abort.\n"); +pr_err ("Etherdev alloc failed, aborting\n" );return -ENOMEM ; }
@@ -2756,35 +2771,34 @@ static int __devinit e100_probe(struct pci_dev *pdev,pci_set_drvdata (pdev, netdev);if ((err =pci_enable_device (pdev))) { -DPRINTK (PROBE ,ERR ,"Cannot enable PCI device, aborting.\n" ); +netif_err (nic, probe, nic->netdev,"Cannot enable PCI device, aborting\n" ); goto err_out_free_dev; }if (!(pci_resource_flags (pdev,0 ) &IORESOURCE_MEM )) { -DPRINTK (PROBE ,ERR ,"Cannot find proper PCI device " -"base address, aborting.\n" ); +netif_err (nic, probe, nic->netdev,"Cannot find proper PCI device base address, aborting\n" ); err = -ENODEV ; goto err_out_disable_pdev; }if ((err =pci_request_regions (pdev,DRV_NAME ))) { -DPRINTK (PROBE ,ERR ,"Cannot obtain PCI resources, aborting.\n" ); +netif_err (nic, probe, nic->netdev,"Cannot obtain PCI resources, aborting\n" ); goto err_out_disable_pdev; }if ((err =pci_set_dma_mask (pdev,DMA_BIT_MASK (32 )))) { -DPRINTK (PROBE ,ERR ,"No usable DMA configuration, aborting.\n" ); +netif_err (nic, probe, nic->netdev,"No usable DMA configuration, aborting\n" ); goto err_out_free_res; }SET_NETDEV_DEV (netdev, &pdev->dev);if (use_io) -DPRINTK (PROBE ,INFO ,"using i/o access mode\n" ); +netif_info (nic, probe, nic->netdev,"using i/o access mode\n" ); nic->csr =pci_iomap (pdev, (use_io ?1 :0 ),sizeof (struct csr ));if (!nic->csr) { -DPRINTK (PROBE ,ERR ,"Cannot map device registers, aborting.\n" ); +netif_err (nic, probe, nic->netdev,"Cannot map device registers, aborting\n" ); err = -ENOMEM ; goto err_out_free_res; }
@@ -2818,7 +2832,7 @@ static int __devinit e100_probe(struct pci_dev *pdev,INIT_WORK (&nic->tx_timeout_task, e100_tx_timeout_task);if ((err =e100_alloc (nic))) { -DPRINTK (PROBE ,ERR ,"Cannot alloc driver memory, aborting.\n" ); +netif_err (nic, probe, nic->netdev,"Cannot alloc driver memory, aborting\n" ); goto err_out_iounmap; }
@@ -2831,13 +2845,11 @@ static int __devinit e100_probe(struct pci_dev *pdev,memcpy (netdev->perm_addr, nic->eeprom,ETH_ALEN );if (!is_valid_ether_addr (netdev->perm_addr)) {if (!eeprom_bad_csum_allow) { -DPRINTK (PROBE ,ERR ,"Invalid MAC address from " -"EEPROM, aborting.\n" ); +netif_err (nic, probe, nic->netdev,"Invalid MAC address from EEPROM, aborting\n" ); err = -EAGAIN ; goto err_out_free; }else { -DPRINTK (PROBE ,ERR ,"Invalid MAC address from EEPROM, " -"you MUST configure one.\n" ); +netif_err (nic, probe, nic->netdev,"Invalid MAC address from EEPROM, you MUST configure one.\n" ); } }
@@ -2853,7 +2865,7 @@ static int __devinit e100_probe(struct pci_dev *pdev,strcpy (netdev->name,"eth%d" );if ((err =register_netdev (netdev))) { -DPRINTK (PROBE ,ERR ,"Cannot register net device, aborting.\n" ); +netif_err (nic, probe, nic->netdev,"Cannot register net device, aborting\n" ); goto err_out_free; } nic->cbs_pool = pci_pool_create(netdev->name,
@@ -2861,9 +2873,10 @@ static int __devinit e100_probe(struct pci_dev *pdev, nic->params.cbs.count *sizeof (struct cb ),sizeof (u32), 0); -DPRINTK (PROBE ,INFO ,"addr 0x%llx, irq %d, MAC addr %pM\n" , - (unsigned long long )pci_resource_start (pdev, use_io ?1 :0 ), - pdev->irq, netdev->dev_addr); +netif_info (nic, probe, nic->netdev, +"addr 0x%llx, irq %d, MAC addr %pM\n" , + (unsigned long long )pci_resource_start (pdev, use_io ?1 :0 ), + pdev->irq, netdev->dev_addr);return 0 ;
@@ -3021,7 +3034,7 @@ static pci_ers_result_t e100_io_slot_reset(struct pci_dev *pdev)struct nic *nic =netdev_priv (netdev);if (pci_enable_device (pdev)) { -printk (KERN_ERR "e100: Cannot re-enable PCI device after reset.\n" ); +pr_err ("Cannot re-enable PCI device after reset\n" );return PCI_ERS_RESULT_DISCONNECT ; }pci_set_master (pdev);
@@ -3080,8 +3093,8 @@ static struct pci_driver e100_driver = {static int __init e100_init_module (void ) {if (((1 << debug) -1 ) &NETIF_MSG_DRV ) { - printk(KERN_INFO PFX "%s, %s\n", DRV_DESCRIPTION, DRV_VERSION); - printk(KERN_INFO PFX "%s\n", DRV_COPYRIGHT); +pr_info ("%s, %s\n" ,DRV_DESCRIPTION ,DRV_VERSION ); +pr_info ("%s\n" ,DRV_COPYRIGHT ); }return pci_register_driver (&e100_driver); }
Re: [PATCH net-next] drivers/net/e100.c: Use pr_<level> and netif_<level>
From: Joe Perches <[email protected]>
Date: Mon, 01 Mar 2010 13:16:21 -0800
Quoted 6 lines
Convert DPRINTK, commonly used for debugging, to netif_<level> Remove #define PFX
Use #definepr_fmt
Consistently use no periods for non-sentence logging messagesSigned-off-by Joe Perches <[email protected]>
Applied.