aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/tehuti.c
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2010-02-15 03:34:22 -0500
committerDavid S. Miller <davem@davemloft.net>2010-02-16 18:45:43 -0500
commit865a21a5e3d1b384c559a44c898fcad93e187b82 (patch)
tree7ade861f21f42ea0bc36747f6acd02cd08f63b1a /drivers/net/tehuti.c
parent6c35abaedc191e2c7c8fa40a2b4c2b01d553b768 (diff)
drivers/net/tehuti.c: Use (pr|netdev|netif)_<levels> macro helpers
Make the output logging messages a bit more consistent. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/tehuti.c')
-rw-r--r--drivers/net/tehuti.c88
1 files changed, 41 insertions, 47 deletions
diff --git a/drivers/net/tehuti.c b/drivers/net/tehuti.c
index ab9b0280317e..82e522a114d2 100644
--- a/drivers/net/tehuti.c
+++ b/drivers/net/tehuti.c
@@ -62,9 +62,11 @@
62 * 62 *
63 */ 63 */
64 64
65#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
66
65#include "tehuti.h" 67#include "tehuti.h"
66 68
67static DEFINE_PCI_DEVICE_TABLE(bdx_pci_tbl) = { 69static struct pci_device_id __devinitdata bdx_pci_tbl[] = {
68 {0x1FC9, 0x3009, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, 70 {0x1FC9, 0x3009, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
69 {0x1FC9, 0x3010, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, 71 {0x1FC9, 0x3010, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
70 {0x1FC9, 0x3014, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, 72 {0x1FC9, 0x3014, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
@@ -105,26 +107,24 @@ static void print_hw_id(struct pci_dev *pdev)
105 pci_read_config_word(pdev, PCI_LINK_STATUS_REG, &pci_link_status); 107 pci_read_config_word(pdev, PCI_LINK_STATUS_REG, &pci_link_status);
106 pci_read_config_word(pdev, PCI_DEV_CTRL_REG, &pci_ctrl); 108 pci_read_config_word(pdev, PCI_DEV_CTRL_REG, &pci_ctrl);
107 109
108 printk(KERN_INFO "tehuti: %s%s\n", BDX_NIC_NAME, 110 pr_info("%s%s\n", BDX_NIC_NAME,
109 nic->port_num == 1 ? "" : ", 2-Port"); 111 nic->port_num == 1 ? "" : ", 2-Port");
110 printk(KERN_INFO 112 pr_info("srom 0x%x fpga %d build %u lane# %d max_pl 0x%x mrrs 0x%x\n",
111 "tehuti: srom 0x%x fpga %d build %u lane# %d" 113 readl(nic->regs + SROM_VER), readl(nic->regs + FPGA_VER) & 0xFFF,
112 " max_pl 0x%x mrrs 0x%x\n", 114 readl(nic->regs + FPGA_SEED),
113 readl(nic->regs + SROM_VER), readl(nic->regs + FPGA_VER) & 0xFFF, 115 GET_LINK_STATUS_LANES(pci_link_status),
114 readl(nic->regs + FPGA_SEED), 116 GET_DEV_CTRL_MAXPL(pci_ctrl), GET_DEV_CTRL_MRRS(pci_ctrl));
115 GET_LINK_STATUS_LANES(pci_link_status),
116 GET_DEV_CTRL_MAXPL(pci_ctrl), GET_DEV_CTRL_MRRS(pci_ctrl));
117} 117}
118 118
119static void print_fw_id(struct pci_nic *nic) 119static void print_fw_id(struct pci_nic *nic)
120{ 120{
121 printk(KERN_INFO "tehuti: fw 0x%x\n", readl(nic->regs + FW_VER)); 121 pr_info("fw 0x%x\n", readl(nic->regs + FW_VER));
122} 122}
123 123
124static void print_eth_id(struct net_device *ndev) 124static void print_eth_id(struct net_device *ndev)
125{ 125{
126 printk(KERN_INFO "%s: %s, Port %c\n", ndev->name, BDX_NIC_NAME, 126 netdev_info(ndev, "%s, Port %c\n",
127 (ndev->if_port == 0) ? 'A' : 'B'); 127 BDX_NIC_NAME, (ndev->if_port == 0) ? 'A' : 'B');
128 128
129} 129}
130 130
@@ -160,7 +160,7 @@ bdx_fifo_init(struct bdx_priv *priv, struct fifo *f, int fsz_type,
160 f->va = pci_alloc_consistent(priv->pdev, 160 f->va = pci_alloc_consistent(priv->pdev,
161 memsz + FIFO_EXTRA_SPACE, &f->da); 161 memsz + FIFO_EXTRA_SPACE, &f->da);
162 if (!f->va) { 162 if (!f->va) {
163 ERR("pci_alloc_consistent failed\n"); 163 pr_err("pci_alloc_consistent failed\n");
164 RET(-ENOMEM); 164 RET(-ENOMEM);
165 } 165 }
166 f->reg_CFG0 = reg_CFG0; 166 f->reg_CFG0 = reg_CFG0;
@@ -204,13 +204,13 @@ static void bdx_link_changed(struct bdx_priv *priv)
204 if (netif_carrier_ok(priv->ndev)) { 204 if (netif_carrier_ok(priv->ndev)) {
205 netif_stop_queue(priv->ndev); 205 netif_stop_queue(priv->ndev);
206 netif_carrier_off(priv->ndev); 206 netif_carrier_off(priv->ndev);
207 ERR("%s: Link Down\n", priv->ndev->name); 207 netdev_err(priv->ndev, "Link Down\n");
208 } 208 }
209 } else { 209 } else {
210 if (!netif_carrier_ok(priv->ndev)) { 210 if (!netif_carrier_ok(priv->ndev)) {
211 netif_wake_queue(priv->ndev); 211 netif_wake_queue(priv->ndev);
212 netif_carrier_on(priv->ndev); 212 netif_carrier_on(priv->ndev);
213 ERR("%s: Link Up\n", priv->ndev->name); 213 netdev_err(priv->ndev, "Link Up\n");
214 } 214 }
215 } 215 }
216} 216}
@@ -226,10 +226,10 @@ static void bdx_isr_extra(struct bdx_priv *priv, u32 isr)
226 bdx_link_changed(priv); 226 bdx_link_changed(priv);
227 227
228 if (isr & IR_PCIE_LINK) 228 if (isr & IR_PCIE_LINK)
229 ERR("%s: PCI-E Link Fault\n", priv->ndev->name); 229 netdev_err(priv->ndev, "PCI-E Link Fault\n");
230 230
231 if (isr & IR_PCIE_TOUT) 231 if (isr & IR_PCIE_TOUT)
232 ERR("%s: PCI-E Time Out\n", priv->ndev->name); 232 netdev_err(priv->ndev, "PCI-E Time Out\n");
233 233
234} 234}
235 235
@@ -345,7 +345,7 @@ out:
345 release_firmware(fw); 345 release_firmware(fw);
346 346
347 if (rc) { 347 if (rc) {
348 ERR("%s: firmware loading failed\n", priv->ndev->name); 348 netdev_err(priv->ndev, "firmware loading failed\n");
349 if (rc == -EIO) 349 if (rc == -EIO)
350 DBG("VPC = 0x%x VIC = 0x%x INIT_STATUS = 0x%x i=%d\n", 350 DBG("VPC = 0x%x VIC = 0x%x INIT_STATUS = 0x%x i=%d\n",
351 READ_REG(priv, regVPC), 351 READ_REG(priv, regVPC),
@@ -462,7 +462,7 @@ static int bdx_hw_reset_direct(void __iomem *regs)
462 readl(regs + regRXD_CFG0_0); 462 readl(regs + regRXD_CFG0_0);
463 return 0; 463 return 0;
464 } 464 }
465 ERR("tehuti: HW reset failed\n"); 465 pr_err("HW reset failed\n");
466 return 1; /* failure */ 466 return 1; /* failure */
467} 467}
468 468
@@ -486,7 +486,7 @@ static int bdx_hw_reset(struct bdx_priv *priv)
486 READ_REG(priv, regRXD_CFG0_0); 486 READ_REG(priv, regRXD_CFG0_0);
487 return 0; 487 return 0;
488 } 488 }
489 ERR("tehuti: HW reset failed\n"); 489 pr_err("HW reset failed\n");
490 return 1; /* failure */ 490 return 1; /* failure */
491} 491}
492 492
@@ -510,8 +510,7 @@ static int bdx_sw_reset(struct bdx_priv *priv)
510 mdelay(10); 510 mdelay(10);
511 } 511 }
512 if (i == 50) 512 if (i == 50)
513 ERR("%s: SW reset timeout. continuing anyway\n", 513 netdev_err(priv->ndev, "SW reset timeout. continuing anyway\n");
514 priv->ndev->name);
515 514
516 /* 6. disable intrs */ 515 /* 6. disable intrs */
517 WRITE_REG(priv, regRDINTCM0, 0); 516 WRITE_REG(priv, regRDINTCM0, 0);
@@ -647,7 +646,7 @@ static int bdx_ioctl_priv(struct net_device *ndev, struct ifreq *ifr, int cmd)
647 if (cmd != SIOCDEVPRIVATE) { 646 if (cmd != SIOCDEVPRIVATE) {
648 error = copy_from_user(data, ifr->ifr_data, sizeof(data)); 647 error = copy_from_user(data, ifr->ifr_data, sizeof(data));
649 if (error) { 648 if (error) {
650 ERR("cant copy from user\n"); 649 pr_err("cant copy from user\n");
651 RET(error); 650 RET(error);
652 } 651 }
653 DBG("%d 0x%x 0x%x\n", data[0], data[1], data[2]); 652 DBG("%d 0x%x 0x%x\n", data[0], data[1], data[2]);
@@ -708,7 +707,7 @@ static void __bdx_vlan_rx_vid(struct net_device *ndev, uint16_t vid, int enable)
708 ENTER; 707 ENTER;
709 DBG2("vid=%d value=%d\n", (int)vid, enable); 708 DBG2("vid=%d value=%d\n", (int)vid, enable);
710 if (unlikely(vid >= 4096)) { 709 if (unlikely(vid >= 4096)) {
711 ERR("tehuti: invalid VID: %u (> 4096)\n", vid); 710 pr_err("invalid VID: %u (> 4096)\n", vid);
712 RET(); 711 RET();
713 } 712 }
714 reg = regVLAN_0 + (vid / 32) * 4; 713 reg = regVLAN_0 + (vid / 32) * 4;
@@ -776,8 +775,8 @@ static int bdx_change_mtu(struct net_device *ndev, int new_mtu)
776 775
777 /* enforce minimum frame size */ 776 /* enforce minimum frame size */
778 if (new_mtu < ETH_ZLEN) { 777 if (new_mtu < ETH_ZLEN) {
779 ERR("%s: %s mtu %d is less then minimal %d\n", 778 netdev_err(ndev, "mtu %d is less then minimal %d\n",
780 BDX_DRV_NAME, ndev->name, new_mtu, ETH_ZLEN); 779 new_mtu, ETH_ZLEN);
781 RET(-EINVAL); 780 RET(-EINVAL);
782 } 781 }
783 782
@@ -1038,7 +1037,7 @@ static int bdx_rx_init(struct bdx_priv *priv)
1038 return 0; 1037 return 0;
1039 1038
1040err_mem: 1039err_mem:
1041 ERR("%s: %s: Rx init failed\n", BDX_DRV_NAME, priv->ndev->name); 1040 netdev_err(priv->ndev, "Rx init failed\n");
1042 return -ENOMEM; 1041 return -ENOMEM;
1043} 1042}
1044 1043
@@ -1116,7 +1115,7 @@ static void bdx_rx_alloc_skbs(struct bdx_priv *priv, struct rxf_fifo *f)
1116 dno = bdx_rxdb_available(db) - 1; 1115 dno = bdx_rxdb_available(db) - 1;
1117 while (dno > 0) { 1116 while (dno > 0) {
1118 if (!(skb = dev_alloc_skb(f->m.pktsz + NET_IP_ALIGN))) { 1117 if (!(skb = dev_alloc_skb(f->m.pktsz + NET_IP_ALIGN))) {
1119 ERR("NO MEM: dev_alloc_skb failed\n"); 1118 pr_err("NO MEM: dev_alloc_skb failed\n");
1120 break; 1119 break;
1121 } 1120 }
1122 skb->dev = priv->ndev; 1121 skb->dev = priv->ndev;
@@ -1337,9 +1336,7 @@ static int bdx_rx_receive(struct bdx_priv *priv, struct rxd_fifo *f, int budget)
1337static void print_rxdd(struct rxd_desc *rxdd, u32 rxd_val1, u16 len, 1336static void print_rxdd(struct rxd_desc *rxdd, u32 rxd_val1, u16 len,
1338 u16 rxd_vlan) 1337 u16 rxd_vlan)
1339{ 1338{
1340 DBG("ERROR: rxdd bc %d rxfq %d to %d type %d err %d rxp %d " 1339 DBG("ERROR: rxdd bc %d rxfq %d to %d type %d err %d rxp %d pkt_id %d vtag %d len %d vlan_id %d cfi %d prio %d va_lo %d va_hi %d\n",
1341 "pkt_id %d vtag %d len %d vlan_id %d cfi %d prio %d "
1342 "va_lo %d va_hi %d\n",
1343 GET_RXD_BC(rxd_val1), GET_RXD_RXFQ(rxd_val1), GET_RXD_TO(rxd_val1), 1340 GET_RXD_BC(rxd_val1), GET_RXD_RXFQ(rxd_val1), GET_RXD_TO(rxd_val1),
1344 GET_RXD_TYPE(rxd_val1), GET_RXD_ERR(rxd_val1), 1341 GET_RXD_TYPE(rxd_val1), GET_RXD_ERR(rxd_val1),
1345 GET_RXD_RXP(rxd_val1), GET_RXD_PKT_ID(rxd_val1), 1342 GET_RXD_RXP(rxd_val1), GET_RXD_PKT_ID(rxd_val1),
@@ -1591,7 +1588,7 @@ static int bdx_tx_init(struct bdx_priv *priv)
1591 return 0; 1588 return 0;
1592 1589
1593err_mem: 1590err_mem:
1594 ERR("tehuti: %s: Tx init failed\n", priv->ndev->name); 1591 netdev_err(priv->ndev, "Tx init failed\n");
1595 return -ENOMEM; 1592 return -ENOMEM;
1596} 1593}
1597 1594
@@ -1946,8 +1943,7 @@ bdx_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
1946 } else { 1943 } else {
1947 if ((err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) || 1944 if ((err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) ||
1948 (err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)))) { 1945 (err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)))) {
1949 printk(KERN_ERR "tehuti: No usable DMA configuration" 1946 pr_err("No usable DMA configuration, aborting\n");
1950 ", aborting\n");
1951 goto err_dma; 1947 goto err_dma;
1952 } 1948 }
1953 pci_using_dac = 0; 1949 pci_using_dac = 0;
@@ -1961,25 +1957,25 @@ bdx_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
1961 pciaddr = pci_resource_start(pdev, 0); 1957 pciaddr = pci_resource_start(pdev, 0);
1962 if (!pciaddr) { 1958 if (!pciaddr) {
1963 err = -EIO; 1959 err = -EIO;
1964 ERR("tehuti: no MMIO resource\n"); 1960 pr_err("no MMIO resource\n");
1965 goto err_out_res; 1961 goto err_out_res;
1966 } 1962 }
1967 if ((regionSize = pci_resource_len(pdev, 0)) < BDX_REGS_SIZE) { 1963 if ((regionSize = pci_resource_len(pdev, 0)) < BDX_REGS_SIZE) {
1968 err = -EIO; 1964 err = -EIO;
1969 ERR("tehuti: MMIO resource (%x) too small\n", regionSize); 1965 pr_err("MMIO resource (%x) too small\n", regionSize);
1970 goto err_out_res; 1966 goto err_out_res;
1971 } 1967 }
1972 1968
1973 nic->regs = ioremap(pciaddr, regionSize); 1969 nic->regs = ioremap(pciaddr, regionSize);
1974 if (!nic->regs) { 1970 if (!nic->regs) {
1975 err = -EIO; 1971 err = -EIO;
1976 ERR("tehuti: ioremap failed\n"); 1972 pr_err("ioremap failed\n");
1977 goto err_out_res; 1973 goto err_out_res;
1978 } 1974 }
1979 1975
1980 if (pdev->irq < 2) { 1976 if (pdev->irq < 2) {
1981 err = -EIO; 1977 err = -EIO;
1982 ERR("tehuti: invalid irq (%d)\n", pdev->irq); 1978 pr_err("invalid irq (%d)\n", pdev->irq);
1983 goto err_out_iomap; 1979 goto err_out_iomap;
1984 } 1980 }
1985 pci_set_drvdata(pdev, nic); 1981 pci_set_drvdata(pdev, nic);
@@ -1997,7 +1993,7 @@ bdx_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
1997#ifdef BDX_MSI 1993#ifdef BDX_MSI
1998 if ((readl(nic->regs + FPGA_VER) & 0xFFF) >= 378) { 1994 if ((readl(nic->regs + FPGA_VER) & 0xFFF) >= 378) {
1999 if ((err = pci_enable_msi(pdev))) 1995 if ((err = pci_enable_msi(pdev)))
2000 ERR("Tehuti: Can't eneble msi. error is %d\n", err); 1996 pr_err("Can't eneble msi. error is %d\n", err);
2001 else 1997 else
2002 nic->irq_type = IRQ_MSI; 1998 nic->irq_type = IRQ_MSI;
2003 } else 1999 } else
@@ -2008,7 +2004,7 @@ bdx_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
2008 for (port = 0; port < nic->port_num; port++) { 2004 for (port = 0; port < nic->port_num; port++) {
2009 if (!(ndev = alloc_etherdev(sizeof(struct bdx_priv)))) { 2005 if (!(ndev = alloc_etherdev(sizeof(struct bdx_priv)))) {
2010 err = -ENOMEM; 2006 err = -ENOMEM;
2011 printk(KERN_ERR "tehuti: alloc_etherdev failed\n"); 2007 pr_err("alloc_etherdev failed\n");
2012 goto err_out_iomap; 2008 goto err_out_iomap;
2013 } 2009 }
2014 2010
@@ -2075,12 +2071,12 @@ bdx_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
2075 2071
2076 /*bdx_hw_reset(priv); */ 2072 /*bdx_hw_reset(priv); */
2077 if (bdx_read_mac(priv)) { 2073 if (bdx_read_mac(priv)) {
2078 printk(KERN_ERR "tehuti: load MAC address failed\n"); 2074 pr_err("load MAC address failed\n");
2079 goto err_out_iomap; 2075 goto err_out_iomap;
2080 } 2076 }
2081 SET_NETDEV_DEV(ndev, &pdev->dev); 2077 SET_NETDEV_DEV(ndev, &pdev->dev);
2082 if ((err = register_netdev(ndev))) { 2078 if ((err = register_netdev(ndev))) {
2083 printk(KERN_ERR "tehuti: register_netdev failed\n"); 2079 pr_err("register_netdev failed\n");
2084 goto err_out_free; 2080 goto err_out_free;
2085 } 2081 }
2086 netif_carrier_off(ndev); 2082 netif_carrier_off(ndev);
@@ -2493,10 +2489,8 @@ static struct pci_driver bdx_pci_driver = {
2493 */ 2489 */
2494static void __init print_driver_id(void) 2490static void __init print_driver_id(void)
2495{ 2491{
2496 printk(KERN_INFO "%s: %s, %s\n", BDX_DRV_NAME, BDX_DRV_DESC, 2492 pr_info("%s, %s\n", BDX_DRV_DESC, BDX_DRV_VERSION);
2497 BDX_DRV_VERSION); 2493 pr_info("Options: hw_csum %s\n", BDX_MSI_STRING);
2498 printk(KERN_INFO "%s: Options: hw_csum %s\n", BDX_DRV_NAME,
2499 BDX_MSI_STRING);
2500} 2494}
2501 2495
2502static int __init bdx_module_init(void) 2496static int __init bdx_module_init(void)