Commit 6a3c2f83 authored by Govindarajulu Varadarajan's avatar Govindarajulu Varadarajan Committed by David S. Miller

enic: use netdev_<foo> or dev_<foo> instead of pr_<foo>

pr_info does not give any details about the interface involved. This patch
uses netdev_info for printing the message. Use dev_info where netdev is not
ready.
Signed-off-by: default avatarGovindarajulu Varadarajan <_govind@gmx.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 8b89f3a1
...@@ -191,6 +191,25 @@ struct enic { ...@@ -191,6 +191,25 @@ struct enic {
struct vnic_gen_stats gen_stats; struct vnic_gen_stats gen_stats;
}; };
static inline struct net_device *vnic_get_netdev(struct vnic_dev *vdev)
{
struct enic *enic = vdev->priv;
return enic->netdev;
}
/* wrappers function for kernel log
* Make sure variable vdev of struct vnic_dev is available in the block where
* these macros are used
*/
#define vdev_info(args...) dev_info(&vdev->pdev->dev, args)
#define vdev_warn(args...) dev_warn(&vdev->pdev->dev, args)
#define vdev_err(args...) dev_err(&vdev->pdev->dev, args)
#define vdev_netinfo(args...) netdev_info(vnic_get_netdev(vdev), args)
#define vdev_netwarn(args...) netdev_warn(vnic_get_netdev(vdev), args)
#define vdev_neterr(args...) netdev_err(vnic_get_netdev(vdev), args)
static inline struct device *enic_get_dev(struct enic *enic) static inline struct device *enic_get_dev(struct enic *enic)
{ {
return &(enic->pdev->dev); return &(enic->pdev->dev);
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include "vnic_dev.h" #include "vnic_dev.h"
#include "vnic_cq.h" #include "vnic_cq.h"
#include "enic.h"
void vnic_cq_free(struct vnic_cq *cq) void vnic_cq_free(struct vnic_cq *cq)
{ {
...@@ -42,7 +43,7 @@ int vnic_cq_alloc(struct vnic_dev *vdev, struct vnic_cq *cq, unsigned int index, ...@@ -42,7 +43,7 @@ int vnic_cq_alloc(struct vnic_dev *vdev, struct vnic_cq *cq, unsigned int index,
cq->ctrl = vnic_dev_get_res(vdev, RES_TYPE_CQ, index); cq->ctrl = vnic_dev_get_res(vdev, RES_TYPE_CQ, index);
if (!cq->ctrl) { if (!cq->ctrl) {
pr_err("Failed to hook CQ[%d] resource\n", index); vdev_err("Failed to hook CQ[%d] resource\n", index);
return -EINVAL; return -EINVAL;
} }
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include "vnic_devcmd.h" #include "vnic_devcmd.h"
#include "vnic_dev.h" #include "vnic_dev.h"
#include "vnic_stats.h" #include "vnic_stats.h"
#include "enic.h"
#define VNIC_MAX_RES_HDR_SIZE \ #define VNIC_MAX_RES_HDR_SIZE \
(sizeof(struct vnic_resource_header) + \ (sizeof(struct vnic_resource_header) + \
...@@ -51,14 +52,14 @@ static int vnic_dev_discover_res(struct vnic_dev *vdev, ...@@ -51,14 +52,14 @@ static int vnic_dev_discover_res(struct vnic_dev *vdev,
return -EINVAL; return -EINVAL;
if (bar->len < VNIC_MAX_RES_HDR_SIZE) { if (bar->len < VNIC_MAX_RES_HDR_SIZE) {
pr_err("vNIC BAR0 res hdr length error\n"); vdev_err("vNIC BAR0 res hdr length error\n");
return -EINVAL; return -EINVAL;
} }
rh = bar->vaddr; rh = bar->vaddr;
mrh = bar->vaddr; mrh = bar->vaddr;
if (!rh) { if (!rh) {
pr_err("vNIC BAR0 res hdr not mem-mapped\n"); vdev_err("vNIC BAR0 res hdr not mem-mapped\n");
return -EINVAL; return -EINVAL;
} }
...@@ -67,11 +68,10 @@ static int vnic_dev_discover_res(struct vnic_dev *vdev, ...@@ -67,11 +68,10 @@ static int vnic_dev_discover_res(struct vnic_dev *vdev,
(ioread32(&rh->version) != VNIC_RES_VERSION)) { (ioread32(&rh->version) != VNIC_RES_VERSION)) {
if ((ioread32(&mrh->magic) != MGMTVNIC_MAGIC) || if ((ioread32(&mrh->magic) != MGMTVNIC_MAGIC) ||
(ioread32(&mrh->version) != MGMTVNIC_VERSION)) { (ioread32(&mrh->version) != MGMTVNIC_VERSION)) {
pr_err("vNIC BAR0 res magic/version error " vdev_err("vNIC BAR0 res magic/version error exp (%lx/%lx) or (%lx/%lx), curr (%x/%x)\n",
"exp (%lx/%lx) or (%lx/%lx), curr (%x/%x)\n", VNIC_RES_MAGIC, VNIC_RES_VERSION,
VNIC_RES_MAGIC, VNIC_RES_VERSION, MGMTVNIC_MAGIC, MGMTVNIC_VERSION,
MGMTVNIC_MAGIC, MGMTVNIC_VERSION, ioread32(&rh->magic), ioread32(&rh->version));
ioread32(&rh->magic), ioread32(&rh->version));
return -EINVAL; return -EINVAL;
} }
} }
...@@ -105,12 +105,9 @@ static int vnic_dev_discover_res(struct vnic_dev *vdev, ...@@ -105,12 +105,9 @@ static int vnic_dev_discover_res(struct vnic_dev *vdev,
/* each count is stride bytes long */ /* each count is stride bytes long */
len = count * VNIC_RES_STRIDE; len = count * VNIC_RES_STRIDE;
if (len + bar_offset > bar[bar_num].len) { if (len + bar_offset > bar[bar_num].len) {
pr_err("vNIC BAR0 resource %d " vdev_err("vNIC BAR0 resource %d out-of-bounds, offset 0x%x + size 0x%x > bar len 0x%lx\n",
"out-of-bounds, offset 0x%x + " type, bar_offset, len,
"size 0x%x > bar len 0x%lx\n", bar[bar_num].len);
type, bar_offset,
len,
bar[bar_num].len);
return -EINVAL; return -EINVAL;
} }
break; break;
...@@ -199,8 +196,8 @@ int vnic_dev_alloc_desc_ring(struct vnic_dev *vdev, struct vnic_dev_ring *ring, ...@@ -199,8 +196,8 @@ int vnic_dev_alloc_desc_ring(struct vnic_dev *vdev, struct vnic_dev_ring *ring,
&ring->base_addr_unaligned); &ring->base_addr_unaligned);
if (!ring->descs_unaligned) { if (!ring->descs_unaligned) {
pr_err("Failed to allocate ring (size=%d), aborting\n", vdev_err("Failed to allocate ring (size=%d), aborting\n",
(int)ring->size); (int)ring->size);
return -ENOMEM; return -ENOMEM;
} }
...@@ -242,7 +239,7 @@ static int _vnic_dev_cmd(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd, ...@@ -242,7 +239,7 @@ static int _vnic_dev_cmd(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd,
return -ENODEV; return -ENODEV;
} }
if (status & STAT_BUSY) { if (status & STAT_BUSY) {
pr_err("Busy devcmd %d\n", _CMD_N(cmd)); vdev_neterr("Busy devcmd %d\n", _CMD_N(cmd));
return -EBUSY; return -EBUSY;
} }
...@@ -276,8 +273,8 @@ static int _vnic_dev_cmd(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd, ...@@ -276,8 +273,8 @@ static int _vnic_dev_cmd(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd,
return -err; return -err;
if (err != ERR_ECMDUNKNOWN || if (err != ERR_ECMDUNKNOWN ||
cmd != CMD_CAPABILITY) cmd != CMD_CAPABILITY)
pr_err("Error %d devcmd %d\n", vdev_neterr("Error %d devcmd %d\n",
err, _CMD_N(cmd)); err, _CMD_N(cmd));
return -err; return -err;
} }
...@@ -291,7 +288,7 @@ static int _vnic_dev_cmd(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd, ...@@ -291,7 +288,7 @@ static int _vnic_dev_cmd(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd,
} }
} }
pr_err("Timedout devcmd %d\n", _CMD_N(cmd)); vdev_neterr("Timedout devcmd %d\n", _CMD_N(cmd));
return -ETIMEDOUT; return -ETIMEDOUT;
} }
...@@ -318,7 +315,8 @@ static int vnic_dev_cmd_proxy(struct vnic_dev *vdev, ...@@ -318,7 +315,8 @@ static int vnic_dev_cmd_proxy(struct vnic_dev *vdev,
err = (int)vdev->args[1]; err = (int)vdev->args[1];
if (err != ERR_ECMDUNKNOWN || if (err != ERR_ECMDUNKNOWN ||
cmd != CMD_CAPABILITY) cmd != CMD_CAPABILITY)
pr_err("Error %d proxy devcmd %d\n", err, _CMD_N(cmd)); vdev_neterr("Error %d proxy devcmd %d\n", err,
_CMD_N(cmd));
return err; return err;
} }
...@@ -611,7 +609,7 @@ int vnic_dev_packet_filter(struct vnic_dev *vdev, int directed, int multicast, ...@@ -611,7 +609,7 @@ int vnic_dev_packet_filter(struct vnic_dev *vdev, int directed, int multicast,
err = vnic_dev_cmd(vdev, CMD_PACKET_FILTER, &a0, &a1, wait); err = vnic_dev_cmd(vdev, CMD_PACKET_FILTER, &a0, &a1, wait);
if (err) if (err)
pr_err("Can't set packet filter\n"); vdev_neterr("Can't set packet filter\n");
return err; return err;
} }
...@@ -628,7 +626,7 @@ int vnic_dev_add_addr(struct vnic_dev *vdev, const u8 *addr) ...@@ -628,7 +626,7 @@ int vnic_dev_add_addr(struct vnic_dev *vdev, const u8 *addr)
err = vnic_dev_cmd(vdev, CMD_ADDR_ADD, &a0, &a1, wait); err = vnic_dev_cmd(vdev, CMD_ADDR_ADD, &a0, &a1, wait);
if (err) if (err)
pr_err("Can't add addr [%pM], %d\n", addr, err); vdev_neterr("Can't add addr [%pM], %d\n", addr, err);
return err; return err;
} }
...@@ -645,7 +643,7 @@ int vnic_dev_del_addr(struct vnic_dev *vdev, const u8 *addr) ...@@ -645,7 +643,7 @@ int vnic_dev_del_addr(struct vnic_dev *vdev, const u8 *addr)
err = vnic_dev_cmd(vdev, CMD_ADDR_DEL, &a0, &a1, wait); err = vnic_dev_cmd(vdev, CMD_ADDR_DEL, &a0, &a1, wait);
if (err) if (err)
pr_err("Can't del addr [%pM], %d\n", addr, err); vdev_neterr("Can't del addr [%pM], %d\n", addr, err);
return err; return err;
} }
...@@ -689,7 +687,7 @@ int vnic_dev_notify_set(struct vnic_dev *vdev, u16 intr) ...@@ -689,7 +687,7 @@ int vnic_dev_notify_set(struct vnic_dev *vdev, u16 intr)
dma_addr_t notify_pa; dma_addr_t notify_pa;
if (vdev->notify || vdev->notify_pa) { if (vdev->notify || vdev->notify_pa) {
pr_err("notify block %p still allocated", vdev->notify); vdev_neterr("notify block %p still allocated", vdev->notify);
return -EINVAL; return -EINVAL;
} }
...@@ -808,7 +806,7 @@ int vnic_dev_intr_coal_timer_info(struct vnic_dev *vdev) ...@@ -808,7 +806,7 @@ int vnic_dev_intr_coal_timer_info(struct vnic_dev *vdev)
*/ */
if ((err == ERR_ECMDUNKNOWN) || if ((err == ERR_ECMDUNKNOWN) ||
(!err && !(vdev->args[0] && vdev->args[1] && vdev->args[2]))) { (!err && !(vdev->args[0] && vdev->args[1] && vdev->args[2]))) {
pr_warn("Using default conversion factor for interrupt coalesce timer\n"); vdev_netwarn("Using default conversion factor for interrupt coalesce timer\n");
vnic_dev_intr_coal_timer_info_default(vdev); vnic_dev_intr_coal_timer_info_default(vdev);
return 0; return 0;
} }
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include "vnic_dev.h" #include "vnic_dev.h"
#include "vnic_intr.h" #include "vnic_intr.h"
#include "enic.h"
void vnic_intr_free(struct vnic_intr *intr) void vnic_intr_free(struct vnic_intr *intr)
{ {
...@@ -39,7 +40,7 @@ int vnic_intr_alloc(struct vnic_dev *vdev, struct vnic_intr *intr, ...@@ -39,7 +40,7 @@ int vnic_intr_alloc(struct vnic_dev *vdev, struct vnic_intr *intr,
intr->ctrl = vnic_dev_get_res(vdev, RES_TYPE_INTR_CTRL, index); intr->ctrl = vnic_dev_get_res(vdev, RES_TYPE_INTR_CTRL, index);
if (!intr->ctrl) { if (!intr->ctrl) {
pr_err("Failed to hook INTR[%d].ctrl resource\n", index); vdev_err("Failed to hook INTR[%d].ctrl resource\n", index);
return -EINVAL; return -EINVAL;
} }
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include "vnic_dev.h" #include "vnic_dev.h"
#include "vnic_rq.h" #include "vnic_rq.h"
#include "enic.h"
static int vnic_rq_alloc_bufs(struct vnic_rq *rq) static int vnic_rq_alloc_bufs(struct vnic_rq *rq)
{ {
...@@ -91,7 +92,7 @@ int vnic_rq_alloc(struct vnic_dev *vdev, struct vnic_rq *rq, unsigned int index, ...@@ -91,7 +92,7 @@ int vnic_rq_alloc(struct vnic_dev *vdev, struct vnic_rq *rq, unsigned int index,
rq->ctrl = vnic_dev_get_res(vdev, RES_TYPE_RQ, index); rq->ctrl = vnic_dev_get_res(vdev, RES_TYPE_RQ, index);
if (!rq->ctrl) { if (!rq->ctrl) {
pr_err("Failed to hook RQ[%d] resource\n", index); vdev_err("Failed to hook RQ[%d] resource\n", index);
return -EINVAL; return -EINVAL;
} }
...@@ -167,6 +168,7 @@ void vnic_rq_enable(struct vnic_rq *rq) ...@@ -167,6 +168,7 @@ void vnic_rq_enable(struct vnic_rq *rq)
int vnic_rq_disable(struct vnic_rq *rq) int vnic_rq_disable(struct vnic_rq *rq)
{ {
unsigned int wait; unsigned int wait;
struct vnic_dev *vdev = rq->vdev;
iowrite32(0, &rq->ctrl->enable); iowrite32(0, &rq->ctrl->enable);
...@@ -177,7 +179,7 @@ int vnic_rq_disable(struct vnic_rq *rq) ...@@ -177,7 +179,7 @@ int vnic_rq_disable(struct vnic_rq *rq)
udelay(10); udelay(10);
} }
pr_err("Failed to disable RQ[%d]\n", rq->index); vdev_neterr("Failed to disable RQ[%d]\n", rq->index);
return -ETIMEDOUT; return -ETIMEDOUT;
} }
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include "vnic_dev.h" #include "vnic_dev.h"
#include "vnic_wq.h" #include "vnic_wq.h"
#include "enic.h"
static int vnic_wq_alloc_bufs(struct vnic_wq *wq) static int vnic_wq_alloc_bufs(struct vnic_wq *wq)
{ {
...@@ -94,7 +95,7 @@ int vnic_wq_alloc(struct vnic_dev *vdev, struct vnic_wq *wq, unsigned int index, ...@@ -94,7 +95,7 @@ int vnic_wq_alloc(struct vnic_dev *vdev, struct vnic_wq *wq, unsigned int index,
wq->ctrl = vnic_dev_get_res(vdev, RES_TYPE_WQ, index); wq->ctrl = vnic_dev_get_res(vdev, RES_TYPE_WQ, index);
if (!wq->ctrl) { if (!wq->ctrl) {
pr_err("Failed to hook WQ[%d] resource\n", index); vdev_err("Failed to hook WQ[%d] resource\n", index);
return -EINVAL; return -EINVAL;
} }
...@@ -158,6 +159,7 @@ void vnic_wq_enable(struct vnic_wq *wq) ...@@ -158,6 +159,7 @@ void vnic_wq_enable(struct vnic_wq *wq)
int vnic_wq_disable(struct vnic_wq *wq) int vnic_wq_disable(struct vnic_wq *wq)
{ {
unsigned int wait; unsigned int wait;
struct vnic_dev *vdev = wq->vdev;
iowrite32(0, &wq->ctrl->enable); iowrite32(0, &wq->ctrl->enable);
...@@ -168,7 +170,7 @@ int vnic_wq_disable(struct vnic_wq *wq) ...@@ -168,7 +170,7 @@ int vnic_wq_disable(struct vnic_wq *wq)
udelay(10); udelay(10);
} }
pr_err("Failed to disable WQ[%d]\n", wq->index); vdev_neterr("Failed to disable WQ[%d]\n", wq->index);
return -ETIMEDOUT; return -ETIMEDOUT;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment