@@ -116,6 +116,8 @@ enum {
IPOIB_NON_CHILD = 0,
IPOIB_LEGACY_CHILD = 1,
IPOIB_RTNL_CHILD = 2,
+
+ IPOIB_MAX_CONSEQ_CQ_ERR = 10,
};
#define IPOIB_OP_RECV (1ul << 31)
@@ -347,6 +349,7 @@ struct ipoib_dev_priv {
u16 pkey_index;
struct ib_pd *pd;
struct ib_cq *recv_cq;
+ int recv_conseq_cq_errs;
struct ib_cq *send_cq;
struct ib_qp *qp;
u32 qkey;
@@ -772,6 +775,8 @@ static inline void ipoib_unregister_debugfs(void) { }
printk(level "%s: " format, ((struct ipoib_dev_priv *) priv)->dev->name , ## arg)
#define ipoib_warn(priv, format, arg...) \
ipoib_printk(KERN_WARNING, priv, format , ## arg)
+#define ipoib_crit(priv, format, arg...) \
+ ipoib_printk(KERN_CRIT, priv, format , ## arg)
extern int ipoib_sendq_size;
extern int ipoib_recvq_size;
@@ -449,7 +449,8 @@ int ipoib_poll(struct napi_struct *napi, int budget)
int t;
int n, i;
- done = 0;
+ done = 0;
+ n = 0;
poll_more:
while (done < budget) {
@@ -475,6 +476,16 @@ poll_more:
break;
}
+ if (unlikely(n < 0) && (n != -EAGAIN)) {
+ if (priv->recv_conseq_cq_errs++ >= IPOIB_MAX_CONSEQ_CQ_ERR) {
+ ipoib_crit(priv,
+ "Too many poll_cq errors, last error: %d\n",
+ n);
+ return done;
+ }
+ } else
+ priv->recv_conseq_cq_errs = 0;
+
if (done < budget) {
napi_complete(napi);
if (unlikely(ib_req_notify_cq(priv->recv_cq,
@@ -181,6 +181,7 @@ int ipoib_transport_dev_init(struct net_device *dev, struct ib_device *ca)
printk(KERN_WARNING "%s: failed to create receive CQ\n", ca->name);
goto out_cm_dev_cleanup;
}
+ priv->recv_conseq_cq_errs = 0;
cq_attr.cqe = ipoib_sendq_size;
priv->send_cq = ib_create_cq(priv->ca, ipoib_send_comp_handler, NULL,