aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/enic
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/enic')
-rw-r--r--drivers/net/enic/enic.h6
-rw-r--r--drivers/net/enic/enic_main.c125
-rw-r--r--drivers/net/enic/enic_res.c27
-rw-r--r--drivers/net/enic/vnic_cq.c2
-rw-r--r--drivers/net/enic/vnic_dev.c29
-rw-r--r--drivers/net/enic/vnic_dev.h3
-rw-r--r--drivers/net/enic/vnic_intr.c3
-rw-r--r--drivers/net/enic/vnic_rq.c6
-rw-r--r--drivers/net/enic/vnic_wq.c6
9 files changed, 98 insertions, 109 deletions
diff --git a/drivers/net/enic/enic.h b/drivers/net/enic/enic.h
index 81c2adeaa9b8..3588ef5e7e4c 100644
--- a/drivers/net/enic/enic.h
+++ b/drivers/net/enic/enic.h
@@ -34,7 +34,6 @@
34#define DRV_DESCRIPTION "Cisco VIC Ethernet NIC Driver" 34#define DRV_DESCRIPTION "Cisco VIC Ethernet NIC Driver"
35#define DRV_VERSION "1.4.1.1" 35#define DRV_VERSION "1.4.1.1"
36#define DRV_COPYRIGHT "Copyright 2008-2009 Cisco Systems, Inc" 36#define DRV_COPYRIGHT "Copyright 2008-2009 Cisco Systems, Inc"
37#define PFX DRV_NAME ": "
38 37
39#define ENIC_BARS_MAX 6 38#define ENIC_BARS_MAX 6
40 39
@@ -130,4 +129,9 @@ struct enic {
130 unsigned int cq_count; 129 unsigned int cq_count;
131}; 130};
132 131
132static inline struct device *enic_get_dev(struct enic *enic)
133{
134 return &(enic->pdev->dev);
135}
136
133#endif /* _ENIC_H_ */ 137#endif /* _ENIC_H_ */
diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c
index 9e0580531143..413e362e3275 100644
--- a/drivers/net/enic/enic_main.c
+++ b/drivers/net/enic/enic_main.c
@@ -418,15 +418,15 @@ static void enic_log_q_error(struct enic *enic)
418 for (i = 0; i < enic->wq_count; i++) { 418 for (i = 0; i < enic->wq_count; i++) {
419 error_status = vnic_wq_error_status(&enic->wq[i]); 419 error_status = vnic_wq_error_status(&enic->wq[i]);
420 if (error_status) 420 if (error_status)
421 printk(KERN_ERR PFX "%s: WQ[%d] error_status %d\n", 421 netdev_err(enic->netdev, "WQ[%d] error_status %d\n",
422 enic->netdev->name, i, error_status); 422 i, error_status);
423 } 423 }
424 424
425 for (i = 0; i < enic->rq_count; i++) { 425 for (i = 0; i < enic->rq_count; i++) {
426 error_status = vnic_rq_error_status(&enic->rq[i]); 426 error_status = vnic_rq_error_status(&enic->rq[i]);
427 if (error_status) 427 if (error_status)
428 printk(KERN_ERR PFX "%s: RQ[%d] error_status %d\n", 428 netdev_err(enic->netdev, "RQ[%d] error_status %d\n",
429 enic->netdev->name, i, error_status); 429 i, error_status);
430 } 430 }
431} 431}
432 432
@@ -435,8 +435,8 @@ static void enic_msglvl_check(struct enic *enic)
435 u32 msg_enable = vnic_dev_msg_lvl(enic->vdev); 435 u32 msg_enable = vnic_dev_msg_lvl(enic->vdev);
436 436
437 if (msg_enable != enic->msg_enable) { 437 if (msg_enable != enic->msg_enable) {
438 printk(KERN_INFO PFX "%s: msg lvl changed from 0x%x to 0x%x\n", 438 netdev_info(enic->netdev, "msg lvl changed from 0x%x to 0x%x\n",
439 enic->netdev->name, enic->msg_enable, msg_enable); 439 enic->msg_enable, msg_enable);
440 enic->msg_enable = msg_enable; 440 enic->msg_enable = msg_enable;
441 } 441 }
442} 442}
@@ -444,14 +444,15 @@ static void enic_msglvl_check(struct enic *enic)
444static void enic_mtu_check(struct enic *enic) 444static void enic_mtu_check(struct enic *enic)
445{ 445{
446 u32 mtu = vnic_dev_mtu(enic->vdev); 446 u32 mtu = vnic_dev_mtu(enic->vdev);
447 struct net_device *netdev = enic->netdev;
447 448
448 if (mtu && mtu != enic->port_mtu) { 449 if (mtu && mtu != enic->port_mtu) {
449 enic->port_mtu = mtu; 450 enic->port_mtu = mtu;
450 if (mtu < enic->netdev->mtu) 451 if (mtu < netdev->mtu)
451 printk(KERN_WARNING PFX 452 netdev_warn(netdev,
452 "%s: interface MTU (%d) set higher " 453 "interface MTU (%d) set higher "
453 "than switch port MTU (%d)\n", 454 "than switch port MTU (%d)\n",
454 enic->netdev->name, enic->netdev->mtu, mtu); 455 netdev->mtu, mtu);
455 } 456 }
456} 457}
457 458
@@ -461,10 +462,10 @@ static void enic_link_check(struct enic *enic)
461 int carrier_ok = netif_carrier_ok(enic->netdev); 462 int carrier_ok = netif_carrier_ok(enic->netdev);
462 463
463 if (link_status && !carrier_ok) { 464 if (link_status && !carrier_ok) {
464 printk(KERN_INFO PFX "%s: Link UP\n", enic->netdev->name); 465 netdev_info(enic->netdev, "Link UP\n");
465 netif_carrier_on(enic->netdev); 466 netif_carrier_on(enic->netdev);
466 } else if (!link_status && carrier_ok) { 467 } else if (!link_status && carrier_ok) {
467 printk(KERN_INFO PFX "%s: Link DOWN\n", enic->netdev->name); 468 netdev_info(enic->netdev, "Link DOWN\n");
468 netif_carrier_off(enic->netdev); 469 netif_carrier_off(enic->netdev);
469 } 470 }
470} 471}
@@ -788,8 +789,7 @@ static netdev_tx_t enic_hard_start_xmit(struct sk_buff *skb,
788 skb_shinfo(skb)->nr_frags + ENIC_DESC_MAX_SPLITS) { 789 skb_shinfo(skb)->nr_frags + ENIC_DESC_MAX_SPLITS) {
789 netif_stop_queue(netdev); 790 netif_stop_queue(netdev);
790 /* This is a hard error, log it */ 791 /* This is a hard error, log it */
791 printk(KERN_ERR PFX "%s: BUG! Tx ring full when " 792 netdev_err(netdev, "BUG! Tx ring full when queue awake!\n");
792 "queue awake!\n", netdev->name);
793 spin_unlock_irqrestore(&enic->wq_lock[0], flags); 793 spin_unlock_irqrestore(&enic->wq_lock[0], flags);
794 return NETDEV_TX_BUSY; 794 return NETDEV_TX_BUSY;
795 } 795 }
@@ -1738,16 +1738,14 @@ static int enic_open(struct net_device *netdev)
1738 1738
1739 err = enic_request_intr(enic); 1739 err = enic_request_intr(enic);
1740 if (err) { 1740 if (err) {
1741 printk(KERN_ERR PFX "%s: Unable to request irq.\n", 1741 netdev_err(netdev, "Unable to request irq.\n");
1742 netdev->name);
1743 return err; 1742 return err;
1744 } 1743 }
1745 1744
1746 err = enic_dev_notify_set(enic); 1745 err = enic_dev_notify_set(enic);
1747 if (err) { 1746 if (err) {
1748 printk(KERN_ERR PFX 1747 netdev_err(netdev,
1749 "%s: Failed to alloc notify buffer, aborting.\n", 1748 "Failed to alloc notify buffer, aborting.\n");
1750 netdev->name);
1751 goto err_out_free_intr; 1749 goto err_out_free_intr;
1752 } 1750 }
1753 1751
@@ -1755,9 +1753,7 @@ static int enic_open(struct net_device *netdev)
1755 vnic_rq_fill(&enic->rq[i], enic->rq_alloc_buf); 1753 vnic_rq_fill(&enic->rq[i], enic->rq_alloc_buf);
1756 /* Need at least one buffer on ring to get going */ 1754 /* Need at least one buffer on ring to get going */
1757 if (vnic_rq_desc_used(&enic->rq[i]) == 0) { 1755 if (vnic_rq_desc_used(&enic->rq[i]) == 0) {
1758 printk(KERN_ERR PFX 1756 netdev_err(netdev, "Unable to alloc receive buffers\n");
1759 "%s: Unable to alloc receive buffers.\n",
1760 netdev->name);
1761 err = -ENOMEM; 1757 err = -ENOMEM;
1762 goto err_out_notify_unset; 1758 goto err_out_notify_unset;
1763 } 1759 }
@@ -1851,10 +1847,9 @@ static int enic_change_mtu(struct net_device *netdev, int new_mtu)
1851 netdev->mtu = new_mtu; 1847 netdev->mtu = new_mtu;
1852 1848
1853 if (netdev->mtu > enic->port_mtu) 1849 if (netdev->mtu > enic->port_mtu)
1854 printk(KERN_WARNING PFX 1850 netdev_warn(netdev,
1855 "%s: interface MTU (%d) set higher " 1851 "interface MTU (%d) set higher than port MTU (%d)\n",
1856 "than port MTU (%d)\n", 1852 netdev->mtu, enic->port_mtu);
1857 netdev->name, netdev->mtu, enic->port_mtu);
1858 1853
1859 if (running) 1854 if (running)
1860 enic_open(netdev); 1855 enic_open(netdev);
@@ -1927,8 +1922,8 @@ static int enic_dev_open(struct enic *enic)
1927 err = enic_dev_wait(enic->vdev, vnic_dev_open, 1922 err = enic_dev_wait(enic->vdev, vnic_dev_open,
1928 vnic_dev_open_done, 0); 1923 vnic_dev_open_done, 0);
1929 if (err) 1924 if (err)
1930 printk(KERN_ERR PFX 1925 dev_err(enic_get_dev(enic), "vNIC device open failed, err %d\n",
1931 "vNIC device open failed, err %d.\n", err); 1926 err);
1932 1927
1933 return err; 1928 return err;
1934} 1929}
@@ -1940,8 +1935,8 @@ static int enic_dev_hang_reset(struct enic *enic)
1940 err = enic_dev_wait(enic->vdev, vnic_dev_hang_reset, 1935 err = enic_dev_wait(enic->vdev, vnic_dev_hang_reset,
1941 vnic_dev_hang_reset_done, 0); 1936 vnic_dev_hang_reset_done, 0);
1942 if (err) 1937 if (err)
1943 printk(KERN_ERR PFX 1938 netdev_err(enic->netdev, "vNIC hang reset failed, err %d\n",
1944 "vNIC hang reset failed, err %d.\n", err); 1939 err);
1945 1940
1946 return err; 1941 return err;
1947} 1942}
@@ -2177,6 +2172,7 @@ static int enic_dev_stats_clear(struct enic *enic)
2177 2172
2178int enic_dev_init(struct enic *enic) 2173int enic_dev_init(struct enic *enic)
2179{ 2174{
2175 struct device *dev = enic_get_dev(enic);
2180 struct net_device *netdev = enic->netdev; 2176 struct net_device *netdev = enic->netdev;
2181 int err; 2177 int err;
2182 2178
@@ -2185,8 +2181,7 @@ int enic_dev_init(struct enic *enic)
2185 2181
2186 err = enic_get_vnic_config(enic); 2182 err = enic_get_vnic_config(enic);
2187 if (err) { 2183 if (err) {
2188 printk(KERN_ERR PFX 2184 dev_err(dev, "Get vNIC configuration failed, aborting\n");
2189 "Get vNIC configuration failed, aborting.\n");
2190 return err; 2185 return err;
2191 } 2186 }
2192 2187
@@ -2201,9 +2196,8 @@ int enic_dev_init(struct enic *enic)
2201 2196
2202 err = enic_set_intr_mode(enic); 2197 err = enic_set_intr_mode(enic);
2203 if (err) { 2198 if (err) {
2204 printk(KERN_ERR PFX 2199 dev_err(dev, "Failed to set intr mode based on resource "
2205 "Failed to set intr mode based on resource " 2200 "counts and system capabilities, aborting\n");
2206 "counts and system capabilities, aborting.\n");
2207 return err; 2201 return err;
2208 } 2202 }
2209 2203
@@ -2212,8 +2206,7 @@ int enic_dev_init(struct enic *enic)
2212 2206
2213 err = enic_alloc_vnic_resources(enic); 2207 err = enic_alloc_vnic_resources(enic);
2214 if (err) { 2208 if (err) {
2215 printk(KERN_ERR PFX 2209 dev_err(dev, "Failed to alloc vNIC resources, aborting\n");
2216 "Failed to alloc vNIC resources, aborting.\n");
2217 goto err_out_free_vnic_resources; 2210 goto err_out_free_vnic_resources;
2218 } 2211 }
2219 2212
@@ -2225,21 +2218,19 @@ int enic_dev_init(struct enic *enic)
2225 2218
2226 err = enic_set_rq_alloc_buf(enic); 2219 err = enic_set_rq_alloc_buf(enic);
2227 if (err) { 2220 if (err) {
2228 printk(KERN_ERR PFX 2221 dev_err(dev, "Failed to set RQ buffer allocator, aborting\n");
2229 "Failed to set RQ buffer allocator, aborting.\n");
2230 goto err_out_free_vnic_resources; 2222 goto err_out_free_vnic_resources;
2231 } 2223 }
2232 2224
2233 err = enic_set_niccfg(enic); 2225 err = enic_set_niccfg(enic);
2234 if (err) { 2226 if (err) {
2235 printk(KERN_ERR PFX 2227 dev_err(dev, "Failed to config nic, aborting\n");
2236 "Failed to config nic, aborting.\n");
2237 goto err_out_free_vnic_resources; 2228 goto err_out_free_vnic_resources;
2238 } 2229 }
2239 2230
2240 err = enic_dev_set_ig_vlan_rewrite_mode(enic); 2231 err = enic_dev_set_ig_vlan_rewrite_mode(enic);
2241 if (err) { 2232 if (err) {
2242 printk(KERN_ERR PFX 2233 netdev_err(netdev,
2243 "Failed to set ingress vlan rewrite mode, aborting.\n"); 2234 "Failed to set ingress vlan rewrite mode, aborting.\n");
2244 goto err_out_free_vnic_resources; 2235 goto err_out_free_vnic_resources;
2245 } 2236 }
@@ -2274,6 +2265,7 @@ static void enic_iounmap(struct enic *enic)
2274static int __devinit enic_probe(struct pci_dev *pdev, 2265static int __devinit enic_probe(struct pci_dev *pdev,
2275 const struct pci_device_id *ent) 2266 const struct pci_device_id *ent)
2276{ 2267{
2268 struct device *dev = &pdev->dev;
2277 struct net_device *netdev; 2269 struct net_device *netdev;
2278 struct enic *enic; 2270 struct enic *enic;
2279 int using_dac = 0; 2271 int using_dac = 0;
@@ -2286,7 +2278,7 @@ static int __devinit enic_probe(struct pci_dev *pdev,
2286 2278
2287 netdev = alloc_etherdev(sizeof(struct enic)); 2279 netdev = alloc_etherdev(sizeof(struct enic));
2288 if (!netdev) { 2280 if (!netdev) {
2289 printk(KERN_ERR PFX "Etherdev alloc failed, aborting.\n"); 2281 pr_err("Etherdev alloc failed, aborting\n");
2290 return -ENOMEM; 2282 return -ENOMEM;
2291 } 2283 }
2292 2284
@@ -2303,15 +2295,13 @@ static int __devinit enic_probe(struct pci_dev *pdev,
2303 2295
2304 err = pci_enable_device(pdev); 2296 err = pci_enable_device(pdev);
2305 if (err) { 2297 if (err) {
2306 printk(KERN_ERR PFX 2298 dev_err(dev, "Cannot enable PCI device, aborting\n");
2307 "Cannot enable PCI device, aborting.\n");
2308 goto err_out_free_netdev; 2299 goto err_out_free_netdev;
2309 } 2300 }
2310 2301
2311 err = pci_request_regions(pdev, DRV_NAME); 2302 err = pci_request_regions(pdev, DRV_NAME);
2312 if (err) { 2303 if (err) {
2313 printk(KERN_ERR PFX 2304 dev_err(dev, "Cannot request PCI regions, aborting\n");
2314 "Cannot request PCI regions, aborting.\n");
2315 goto err_out_disable_device; 2305 goto err_out_disable_device;
2316 } 2306 }
2317 2307
@@ -2326,23 +2316,20 @@ static int __devinit enic_probe(struct pci_dev *pdev,
2326 if (err) { 2316 if (err) {
2327 err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); 2317 err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
2328 if (err) { 2318 if (err) {
2329 printk(KERN_ERR PFX 2319 dev_err(dev, "No usable DMA configuration, aborting\n");
2330 "No usable DMA configuration, aborting.\n");
2331 goto err_out_release_regions; 2320 goto err_out_release_regions;
2332 } 2321 }
2333 err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); 2322 err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32));
2334 if (err) { 2323 if (err) {
2335 printk(KERN_ERR PFX 2324 dev_err(dev, "Unable to obtain %u-bit DMA "
2336 "Unable to obtain 32-bit DMA " 2325 "for consistent allocations, aborting\n", 32);
2337 "for consistent allocations, aborting.\n");
2338 goto err_out_release_regions; 2326 goto err_out_release_regions;
2339 } 2327 }
2340 } else { 2328 } else {
2341 err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(40)); 2329 err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(40));
2342 if (err) { 2330 if (err) {
2343 printk(KERN_ERR PFX 2331 dev_err(dev, "Unable to obtain %u-bit DMA "
2344 "Unable to obtain 40-bit DMA " 2332 "for consistent allocations, aborting\n", 40);
2345 "for consistent allocations, aborting.\n");
2346 goto err_out_release_regions; 2333 goto err_out_release_regions;
2347 } 2334 }
2348 using_dac = 1; 2335 using_dac = 1;
@@ -2357,8 +2344,7 @@ static int __devinit enic_probe(struct pci_dev *pdev,
2357 enic->bar[i].len = pci_resource_len(pdev, i); 2344 enic->bar[i].len = pci_resource_len(pdev, i);
2358 enic->bar[i].vaddr = pci_iomap(pdev, i, enic->bar[i].len); 2345 enic->bar[i].vaddr = pci_iomap(pdev, i, enic->bar[i].len);
2359 if (!enic->bar[i].vaddr) { 2346 if (!enic->bar[i].vaddr) {
2360 printk(KERN_ERR PFX 2347 dev_err(dev, "Cannot memory-map BAR %d, aborting\n", i);
2361 "Cannot memory-map BAR %d, aborting.\n", i);
2362 err = -ENODEV; 2348 err = -ENODEV;
2363 goto err_out_iounmap; 2349 goto err_out_iounmap;
2364 } 2350 }
@@ -2371,8 +2357,7 @@ static int __devinit enic_probe(struct pci_dev *pdev,
2371 enic->vdev = vnic_dev_register(NULL, enic, pdev, enic->bar, 2357 enic->vdev = vnic_dev_register(NULL, enic, pdev, enic->bar,
2372 ARRAY_SIZE(enic->bar)); 2358 ARRAY_SIZE(enic->bar));
2373 if (!enic->vdev) { 2359 if (!enic->vdev) {
2374 printk(KERN_ERR PFX 2360 dev_err(dev, "vNIC registration failed, aborting\n");
2375 "vNIC registration failed, aborting.\n");
2376 err = -ENODEV; 2361 err = -ENODEV;
2377 goto err_out_iounmap; 2362 goto err_out_iounmap;
2378 } 2363 }
@@ -2382,8 +2367,7 @@ static int __devinit enic_probe(struct pci_dev *pdev,
2382 2367
2383 err = enic_dev_open(enic); 2368 err = enic_dev_open(enic);
2384 if (err) { 2369 if (err) {
2385 printk(KERN_ERR PFX 2370 dev_err(dev, "vNIC dev open failed, aborting\n");
2386 "vNIC dev open failed, aborting.\n");
2387 goto err_out_vnic_unregister; 2371 goto err_out_vnic_unregister;
2388 } 2372 }
2389 2373
@@ -2397,11 +2381,15 @@ static int __devinit enic_probe(struct pci_dev *pdev,
2397 2381
2398 netif_carrier_off(netdev); 2382 netif_carrier_off(netdev);
2399 2383
2384 /* Do not call dev_init for a dynamic vnic.
2385 * For a dynamic vnic, init_prov_info will be
2386 * called later by an upper layer.
2387 */
2388
2400 if (!enic_is_dynamic(enic)) { 2389 if (!enic_is_dynamic(enic)) {
2401 err = vnic_dev_init(enic->vdev, 0); 2390 err = vnic_dev_init(enic->vdev, 0);
2402 if (err) { 2391 if (err) {
2403 printk(KERN_ERR PFX 2392 dev_err(dev, "vNIC dev init failed, aborting\n");
2404 "vNIC dev init failed, aborting.\n");
2405 goto err_out_dev_close; 2393 goto err_out_dev_close;
2406 } 2394 }
2407 } 2395 }
@@ -2413,8 +2401,7 @@ static int __devinit enic_probe(struct pci_dev *pdev,
2413 2401
2414 err = enic_dev_init(enic); 2402 err = enic_dev_init(enic);
2415 if (err) { 2403 if (err) {
2416 printk(KERN_ERR PFX 2404 dev_err(dev, "Device initialization failed, aborting\n");
2417 "Device initialization failed, aborting.\n");
2418 goto err_out_dev_close; 2405 goto err_out_dev_close;
2419 } 2406 }
2420 2407
@@ -2438,8 +2425,7 @@ static int __devinit enic_probe(struct pci_dev *pdev,
2438 2425
2439 err = enic_set_mac_addr(netdev, enic->mac_addr); 2426 err = enic_set_mac_addr(netdev, enic->mac_addr);
2440 if (err) { 2427 if (err) {
2441 printk(KERN_ERR PFX 2428 dev_err(dev, "Invalid MAC address, aborting\n");
2442 "Invalid MAC address, aborting.\n");
2443 goto err_out_dev_deinit; 2429 goto err_out_dev_deinit;
2444 } 2430 }
2445 2431
@@ -2469,8 +2455,7 @@ static int __devinit enic_probe(struct pci_dev *pdev,
2469 2455
2470 err = register_netdev(netdev); 2456 err = register_netdev(netdev);
2471 if (err) { 2457 if (err) {
2472 printk(KERN_ERR PFX 2458 dev_err(dev, "Cannot register net device, aborting\n");
2473 "Cannot register net device, aborting.\n");
2474 goto err_out_dev_deinit; 2459 goto err_out_dev_deinit;
2475 } 2460 }
2476 2461
@@ -2524,7 +2509,7 @@ static struct pci_driver enic_driver = {
2524 2509
2525static int __init enic_init_module(void) 2510static int __init enic_init_module(void)
2526{ 2511{
2527 printk(KERN_INFO PFX "%s, ver %s\n", DRV_DESCRIPTION, DRV_VERSION); 2512 pr_info("%s, ver %s\n", DRV_DESCRIPTION, DRV_VERSION);
2528 2513
2529 return pci_register_driver(&enic_driver); 2514 return pci_register_driver(&enic_driver);
2530} 2515}
diff --git a/drivers/net/enic/enic_res.c b/drivers/net/enic/enic_res.c
index 04cfc4e3f063..478928b7cc09 100644
--- a/drivers/net/enic/enic_res.c
+++ b/drivers/net/enic/enic_res.c
@@ -46,7 +46,8 @@ int enic_get_vnic_config(struct enic *enic)
46 46
47 err = vnic_dev_mac_addr(enic->vdev, enic->mac_addr); 47 err = vnic_dev_mac_addr(enic->vdev, enic->mac_addr);
48 if (err) { 48 if (err) {
49 printk(KERN_ERR PFX "Error getting MAC addr, %d\n", err); 49 dev_err(enic_get_dev(enic),
50 "Error getting MAC addr, %d\n", err);
50 return err; 51 return err;
51 } 52 }
52 53
@@ -56,7 +57,7 @@ int enic_get_vnic_config(struct enic *enic)
56 offsetof(struct vnic_enet_config, m), \ 57 offsetof(struct vnic_enet_config, m), \
57 sizeof(c->m), &c->m); \ 58 sizeof(c->m), &c->m); \
58 if (err) { \ 59 if (err) { \
59 printk(KERN_ERR PFX \ 60 dev_err(enic_get_dev(enic), \
60 "Error getting %s, %d\n", #m, err); \ 61 "Error getting %s, %d\n", #m, err); \
61 return err; \ 62 return err; \
62 } \ 63 } \
@@ -92,10 +93,10 @@ int enic_get_vnic_config(struct enic *enic)
92 INTR_COALESCE_HW_TO_USEC(VNIC_INTR_TIMER_MAX), 93 INTR_COALESCE_HW_TO_USEC(VNIC_INTR_TIMER_MAX),
93 c->intr_timer_usec); 94 c->intr_timer_usec);
94 95
95 printk(KERN_INFO PFX "vNIC MAC addr %pM wq/rq %d/%d\n", 96 dev_info(enic_get_dev(enic), "vNIC MAC addr %pM wq/rq %d/%d\n",
96 enic->mac_addr, c->wq_desc_count, c->rq_desc_count); 97 enic->mac_addr, c->wq_desc_count, c->rq_desc_count);
97 printk(KERN_INFO PFX "vNIC mtu %d csum tx/rx %d/%d tso/lro %d/%d " 98 dev_info(enic_get_dev(enic), "vNIC mtu %d csum tx/rx %d/%d "
98 "intr timer %d usec\n", 99 "tso/lro %d/%d intr timer %d usec\n",
99 c->mtu, ENIC_SETTING(enic, TXCSUM), 100 c->mtu, ENIC_SETTING(enic, TXCSUM),
100 ENIC_SETTING(enic, RXCSUM), ENIC_SETTING(enic, TSO), 101 ENIC_SETTING(enic, RXCSUM), ENIC_SETTING(enic, TSO),
101 ENIC_SETTING(enic, LRO), c->intr_timer_usec); 102 ENIC_SETTING(enic, LRO), c->intr_timer_usec);
@@ -111,7 +112,7 @@ int enic_add_vlan(struct enic *enic, u16 vlanid)
111 112
112 err = vnic_dev_cmd(enic->vdev, CMD_VLAN_ADD, &a0, &a1, wait); 113 err = vnic_dev_cmd(enic->vdev, CMD_VLAN_ADD, &a0, &a1, wait);
113 if (err) 114 if (err)
114 printk(KERN_ERR PFX "Can't add vlan id, %d\n", err); 115 dev_err(enic_get_dev(enic), "Can't add vlan id, %d\n", err);
115 116
116 return err; 117 return err;
117} 118}
@@ -124,7 +125,7 @@ int enic_del_vlan(struct enic *enic, u16 vlanid)
124 125
125 err = vnic_dev_cmd(enic->vdev, CMD_VLAN_DEL, &a0, &a1, wait); 126 err = vnic_dev_cmd(enic->vdev, CMD_VLAN_DEL, &a0, &a1, wait);
126 if (err) 127 if (err)
127 printk(KERN_ERR PFX "Can't delete vlan id, %d\n", err); 128 dev_err(enic_get_dev(enic), "Can't delete vlan id, %d\n", err);
128 129
129 return err; 130 return err;
130} 131}
@@ -192,8 +193,8 @@ void enic_get_res_counts(struct enic *enic)
192 vnic_dev_get_res_count(enic->vdev, RES_TYPE_INTR_CTRL), 193 vnic_dev_get_res_count(enic->vdev, RES_TYPE_INTR_CTRL),
193 ENIC_INTR_MAX); 194 ENIC_INTR_MAX);
194 195
195 printk(KERN_INFO PFX "vNIC resources avail: " 196 dev_info(enic_get_dev(enic),
196 "wq %d rq %d cq %d intr %d\n", 197 "vNIC resources avail: wq %d rq %d cq %d intr %d\n",
197 enic->wq_count, enic->rq_count, 198 enic->wq_count, enic->rq_count,
198 enic->cq_count, enic->intr_count); 199 enic->cq_count, enic->intr_count);
199} 200}
@@ -308,15 +309,14 @@ int enic_alloc_vnic_resources(struct enic *enic)
308 309
309 intr_mode = vnic_dev_get_intr_mode(enic->vdev); 310 intr_mode = vnic_dev_get_intr_mode(enic->vdev);
310 311
311 printk(KERN_INFO PFX "vNIC resources used: " 312 dev_info(enic_get_dev(enic), "vNIC resources used: "
312 "wq %d rq %d cq %d intr %d intr mode %s\n", 313 "wq %d rq %d cq %d intr %d intr mode %s\n",
313 enic->wq_count, enic->rq_count, 314 enic->wq_count, enic->rq_count,
314 enic->cq_count, enic->intr_count, 315 enic->cq_count, enic->intr_count,
315 intr_mode == VNIC_DEV_INTR_MODE_INTX ? "legacy PCI INTx" : 316 intr_mode == VNIC_DEV_INTR_MODE_INTX ? "legacy PCI INTx" :
316 intr_mode == VNIC_DEV_INTR_MODE_MSI ? "MSI" : 317 intr_mode == VNIC_DEV_INTR_MODE_MSI ? "MSI" :
317 intr_mode == VNIC_DEV_INTR_MODE_MSIX ? "MSI-X" : 318 intr_mode == VNIC_DEV_INTR_MODE_MSIX ? "MSI-X" :
318 "unknown" 319 "unknown");
319 );
320 320
321 /* Allocate queue resources 321 /* Allocate queue resources
322 */ 322 */
@@ -362,7 +362,8 @@ int enic_alloc_vnic_resources(struct enic *enic)
362 enic->legacy_pba = vnic_dev_get_res(enic->vdev, 362 enic->legacy_pba = vnic_dev_get_res(enic->vdev,
363 RES_TYPE_INTR_PBA_LEGACY, 0); 363 RES_TYPE_INTR_PBA_LEGACY, 0);
364 if (!enic->legacy_pba && intr_mode == VNIC_DEV_INTR_MODE_INTX) { 364 if (!enic->legacy_pba && intr_mode == VNIC_DEV_INTR_MODE_INTX) {
365 printk(KERN_ERR PFX "Failed to hook legacy pba resource\n"); 365 dev_err(enic_get_dev(enic),
366 "Failed to hook legacy pba resource\n");
366 err = -ENODEV; 367 err = -ENODEV;
367 goto err_out_cleanup; 368 goto err_out_cleanup;
368 } 369 }
diff --git a/drivers/net/enic/vnic_cq.c b/drivers/net/enic/vnic_cq.c
index 020ae6c3f3d9..326ea40297f2 100644
--- a/drivers/net/enic/vnic_cq.c
+++ b/drivers/net/enic/vnic_cq.c
@@ -42,7 +42,7 @@ int vnic_cq_alloc(struct vnic_dev *vdev, struct vnic_cq *cq, unsigned int index,
42 42
43 cq->ctrl = vnic_dev_get_res(vdev, RES_TYPE_CQ, index); 43 cq->ctrl = vnic_dev_get_res(vdev, RES_TYPE_CQ, index);
44 if (!cq->ctrl) { 44 if (!cq->ctrl) {
45 printk(KERN_ERR "Failed to hook CQ[%d] resource\n", index); 45 pr_err("Failed to hook CQ[%d] resource\n", index);
46 return -EINVAL; 46 return -EINVAL;
47 } 47 }
48 48
diff --git a/drivers/net/enic/vnic_dev.c b/drivers/net/enic/vnic_dev.c
index bebadb325b9c..042f4b84a870 100644
--- a/drivers/net/enic/vnic_dev.c
+++ b/drivers/net/enic/vnic_dev.c
@@ -78,19 +78,19 @@ static int vnic_dev_discover_res(struct vnic_dev *vdev,
78 return -EINVAL; 78 return -EINVAL;
79 79
80 if (bar->len < VNIC_MAX_RES_HDR_SIZE) { 80 if (bar->len < VNIC_MAX_RES_HDR_SIZE) {
81 printk(KERN_ERR "vNIC BAR0 res hdr length error\n"); 81 pr_err("vNIC BAR0 res hdr length error\n");
82 return -EINVAL; 82 return -EINVAL;
83 } 83 }
84 84
85 rh = bar->vaddr; 85 rh = bar->vaddr;
86 if (!rh) { 86 if (!rh) {
87 printk(KERN_ERR "vNIC BAR0 res hdr not mem-mapped\n"); 87 pr_err("vNIC BAR0 res hdr not mem-mapped\n");
88 return -EINVAL; 88 return -EINVAL;
89 } 89 }
90 90
91 if (ioread32(&rh->magic) != VNIC_RES_MAGIC || 91 if (ioread32(&rh->magic) != VNIC_RES_MAGIC ||
92 ioread32(&rh->version) != VNIC_RES_VERSION) { 92 ioread32(&rh->version) != VNIC_RES_VERSION) {
93 printk(KERN_ERR "vNIC BAR0 res magic/version error " 93 pr_err("vNIC BAR0 res magic/version error "
94 "exp (%lx/%lx) curr (%x/%x)\n", 94 "exp (%lx/%lx) curr (%x/%x)\n",
95 VNIC_RES_MAGIC, VNIC_RES_VERSION, 95 VNIC_RES_MAGIC, VNIC_RES_VERSION,
96 ioread32(&rh->magic), ioread32(&rh->version)); 96 ioread32(&rh->magic), ioread32(&rh->version));
@@ -122,7 +122,7 @@ static int vnic_dev_discover_res(struct vnic_dev *vdev,
122 /* each count is stride bytes long */ 122 /* each count is stride bytes long */
123 len = count * VNIC_RES_STRIDE; 123 len = count * VNIC_RES_STRIDE;
124 if (len + bar_offset > bar[bar_num].len) { 124 if (len + bar_offset > bar[bar_num].len) {
125 printk(KERN_ERR "vNIC BAR0 resource %d " 125 pr_err("vNIC BAR0 resource %d "
126 "out-of-bounds, offset 0x%x + " 126 "out-of-bounds, offset 0x%x + "
127 "size 0x%x > bar len 0x%lx\n", 127 "size 0x%x > bar len 0x%lx\n",
128 type, bar_offset, 128 type, bar_offset,
@@ -229,8 +229,7 @@ int vnic_dev_alloc_desc_ring(struct vnic_dev *vdev, struct vnic_dev_ring *ring,
229 &ring->base_addr_unaligned); 229 &ring->base_addr_unaligned);
230 230
231 if (!ring->descs_unaligned) { 231 if (!ring->descs_unaligned) {
232 printk(KERN_ERR 232 pr_err("Failed to allocate ring (size=%d), aborting\n",
233 "Failed to allocate ring (size=%d), aborting\n",
234 (int)ring->size); 233 (int)ring->size);
235 return -ENOMEM; 234 return -ENOMEM;
236 } 235 }
@@ -268,7 +267,7 @@ int vnic_dev_cmd(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd,
268 267
269 status = ioread32(&devcmd->status); 268 status = ioread32(&devcmd->status);
270 if (status & STAT_BUSY) { 269 if (status & STAT_BUSY) {
271 printk(KERN_ERR "Busy devcmd %d\n", _CMD_N(cmd)); 270 pr_err("Busy devcmd %d\n", _CMD_N(cmd));
272 return -EBUSY; 271 return -EBUSY;
273 } 272 }
274 273
@@ -294,7 +293,7 @@ int vnic_dev_cmd(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd,
294 err = (int)readq(&devcmd->args[0]); 293 err = (int)readq(&devcmd->args[0]);
295 if (err != ERR_ECMDUNKNOWN || 294 if (err != ERR_ECMDUNKNOWN ||
296 cmd != CMD_CAPABILITY) 295 cmd != CMD_CAPABILITY)
297 printk(KERN_ERR "Error %d devcmd %d\n", 296 pr_err("Error %d devcmd %d\n",
298 err, _CMD_N(cmd)); 297 err, _CMD_N(cmd));
299 return err; 298 return err;
300 } 299 }
@@ -309,7 +308,7 @@ int vnic_dev_cmd(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd,
309 } 308 }
310 } 309 }
311 310
312 printk(KERN_ERR "Timedout devcmd %d\n", _CMD_N(cmd)); 311 pr_err("Timedout devcmd %d\n", _CMD_N(cmd));
313 return -ETIMEDOUT; 312 return -ETIMEDOUT;
314} 313}
315 314
@@ -565,7 +564,7 @@ int vnic_dev_packet_filter(struct vnic_dev *vdev, int directed, int multicast,
565 564
566 err = vnic_dev_cmd(vdev, CMD_PACKET_FILTER, &a0, &a1, wait); 565 err = vnic_dev_cmd(vdev, CMD_PACKET_FILTER, &a0, &a1, wait);
567 if (err) 566 if (err)
568 printk(KERN_ERR "Can't set packet filter\n"); 567 pr_err("Can't set packet filter\n");
569 568
570 return err; 569 return err;
571} 570}
@@ -582,7 +581,7 @@ int vnic_dev_add_addr(struct vnic_dev *vdev, u8 *addr)
582 581
583 err = vnic_dev_cmd(vdev, CMD_ADDR_ADD, &a0, &a1, wait); 582 err = vnic_dev_cmd(vdev, CMD_ADDR_ADD, &a0, &a1, wait);
584 if (err) 583 if (err)
585 printk(KERN_ERR "Can't add addr [%pM], %d\n", addr, err); 584 pr_err("Can't add addr [%pM], %d\n", addr, err);
586 585
587 return err; 586 return err;
588} 587}
@@ -599,7 +598,7 @@ int vnic_dev_del_addr(struct vnic_dev *vdev, u8 *addr)
599 598
600 err = vnic_dev_cmd(vdev, CMD_ADDR_DEL, &a0, &a1, wait); 599 err = vnic_dev_cmd(vdev, CMD_ADDR_DEL, &a0, &a1, wait);
601 if (err) 600 if (err)
602 printk(KERN_ERR "Can't del addr [%pM], %d\n", addr, err); 601 pr_err("Can't del addr [%pM], %d\n", addr, err);
603 602
604 return err; 603 return err;
605} 604}
@@ -626,8 +625,7 @@ int vnic_dev_raise_intr(struct vnic_dev *vdev, u16 intr)
626 625
627 err = vnic_dev_cmd(vdev, CMD_IAR, &a0, &a1, wait); 626 err = vnic_dev_cmd(vdev, CMD_IAR, &a0, &a1, wait);
628 if (err) 627 if (err)
629 printk(KERN_ERR "Failed to raise INTR[%d], err %d\n", 628 pr_err("Failed to raise INTR[%d], err %d\n", intr, err);
630 intr, err);
631 629
632 return err; 630 return err;
633} 631}
@@ -658,8 +656,7 @@ int vnic_dev_notify_set(struct vnic_dev *vdev, u16 intr)
658 dma_addr_t notify_pa; 656 dma_addr_t notify_pa;
659 657
660 if (vdev->notify || vdev->notify_pa) { 658 if (vdev->notify || vdev->notify_pa) {
661 printk(KERN_ERR "notify block %p still allocated", 659 pr_err("notify block %p still allocated", vdev->notify);
662 vdev->notify);
663 return -EINVAL; 660 return -EINVAL;
664 } 661 }
665 662
diff --git a/drivers/net/enic/vnic_dev.h b/drivers/net/enic/vnic_dev.h
index 3a2968180641..11659c6678f5 100644
--- a/drivers/net/enic/vnic_dev.h
+++ b/drivers/net/enic/vnic_dev.h
@@ -41,6 +41,9 @@ static inline void writeq(u64 val, void __iomem *reg)
41} 41}
42#endif 42#endif
43 43
44#undef pr_fmt
45#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
46
44enum vnic_dev_hw_version { 47enum vnic_dev_hw_version {
45 VNIC_DEV_HW_VER_UNKNOWN, 48 VNIC_DEV_HW_VER_UNKNOWN,
46 VNIC_DEV_HW_VER_A1, 49 VNIC_DEV_HW_VER_A1,
diff --git a/drivers/net/enic/vnic_intr.c b/drivers/net/enic/vnic_intr.c
index 3934309a9498..416eae73fa0a 100644
--- a/drivers/net/enic/vnic_intr.c
+++ b/drivers/net/enic/vnic_intr.c
@@ -39,8 +39,7 @@ int vnic_intr_alloc(struct vnic_dev *vdev, struct vnic_intr *intr,
39 39
40 intr->ctrl = vnic_dev_get_res(vdev, RES_TYPE_INTR_CTRL, index); 40 intr->ctrl = vnic_dev_get_res(vdev, RES_TYPE_INTR_CTRL, index);
41 if (!intr->ctrl) { 41 if (!intr->ctrl) {
42 printk(KERN_ERR "Failed to hook INTR[%d].ctrl resource\n", 42 pr_err("Failed to hook INTR[%d].ctrl resource\n", index);
43 index);
44 return -EINVAL; 43 return -EINVAL;
45 } 44 }
46 45
diff --git a/drivers/net/enic/vnic_rq.c b/drivers/net/enic/vnic_rq.c
index cc580cfec41d..6d84ca840052 100644
--- a/drivers/net/enic/vnic_rq.c
+++ b/drivers/net/enic/vnic_rq.c
@@ -39,7 +39,7 @@ static int vnic_rq_alloc_bufs(struct vnic_rq *rq)
39 for (i = 0; i < blks; i++) { 39 for (i = 0; i < blks; i++) {
40 rq->bufs[i] = kzalloc(VNIC_RQ_BUF_BLK_SZ, GFP_ATOMIC); 40 rq->bufs[i] = kzalloc(VNIC_RQ_BUF_BLK_SZ, GFP_ATOMIC);
41 if (!rq->bufs[i]) { 41 if (!rq->bufs[i]) {
42 printk(KERN_ERR "Failed to alloc rq_bufs\n"); 42 pr_err("Failed to alloc rq_bufs\n");
43 return -ENOMEM; 43 return -ENOMEM;
44 } 44 }
45 } 45 }
@@ -94,7 +94,7 @@ int vnic_rq_alloc(struct vnic_dev *vdev, struct vnic_rq *rq, unsigned int index,
94 94
95 rq->ctrl = vnic_dev_get_res(vdev, RES_TYPE_RQ, index); 95 rq->ctrl = vnic_dev_get_res(vdev, RES_TYPE_RQ, index);
96 if (!rq->ctrl) { 96 if (!rq->ctrl) {
97 printk(KERN_ERR "Failed to hook RQ[%d] resource\n", index); 97 pr_err("Failed to hook RQ[%d] resource\n", index);
98 return -EINVAL; 98 return -EINVAL;
99 } 99 }
100 100
@@ -174,7 +174,7 @@ int vnic_rq_disable(struct vnic_rq *rq)
174 udelay(10); 174 udelay(10);
175 } 175 }
176 176
177 printk(KERN_ERR "Failed to disable RQ[%d]\n", rq->index); 177 pr_err("Failed to disable RQ[%d]\n", rq->index);
178 178
179 return -ETIMEDOUT; 179 return -ETIMEDOUT;
180} 180}
diff --git a/drivers/net/enic/vnic_wq.c b/drivers/net/enic/vnic_wq.c
index 1378afbdfe67..ed090a3d9319 100644
--- a/drivers/net/enic/vnic_wq.c
+++ b/drivers/net/enic/vnic_wq.c
@@ -39,7 +39,7 @@ static int vnic_wq_alloc_bufs(struct vnic_wq *wq)
39 for (i = 0; i < blks; i++) { 39 for (i = 0; i < blks; i++) {
40 wq->bufs[i] = kzalloc(VNIC_WQ_BUF_BLK_SZ, GFP_ATOMIC); 40 wq->bufs[i] = kzalloc(VNIC_WQ_BUF_BLK_SZ, GFP_ATOMIC);
41 if (!wq->bufs[i]) { 41 if (!wq->bufs[i]) {
42 printk(KERN_ERR "Failed to alloc wq_bufs\n"); 42 pr_err("Failed to alloc wq_bufs\n");
43 return -ENOMEM; 43 return -ENOMEM;
44 } 44 }
45 } 45 }
@@ -94,7 +94,7 @@ int vnic_wq_alloc(struct vnic_dev *vdev, struct vnic_wq *wq, unsigned int index,
94 94
95 wq->ctrl = vnic_dev_get_res(vdev, RES_TYPE_WQ, index); 95 wq->ctrl = vnic_dev_get_res(vdev, RES_TYPE_WQ, index);
96 if (!wq->ctrl) { 96 if (!wq->ctrl) {
97 printk(KERN_ERR "Failed to hook WQ[%d] resource\n", index); 97 pr_err("Failed to hook WQ[%d] resource\n", index);
98 return -EINVAL; 98 return -EINVAL;
99 } 99 }
100 100
@@ -167,7 +167,7 @@ int vnic_wq_disable(struct vnic_wq *wq)
167 udelay(10); 167 udelay(10);
168 } 168 }
169 169
170 printk(KERN_ERR "Failed to disable WQ[%d]\n", wq->index); 170 pr_err("Failed to disable WQ[%d]\n", wq->index);
171 171
172 return -ETIMEDOUT; 172 return -ETIMEDOUT;
173} 173}