ehea: Add some info messages and fix an issue

This patch adds some debug information about ehea not being able to
allocate enough spaces. Also it correctly updates the amount of available
skb.

Signed-off-by: Breno Leitao <leitao@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by Breno Leitao and committed by David S. Miller 5c7e57f7 8e65c0ec

+14 -4
+14 -4
drivers/net/ehea/ehea_main.c
··· 400 400 skb_arr_rq1[index] = netdev_alloc_skb(dev, 401 401 EHEA_L_PKT_SIZE); 402 402 if (!skb_arr_rq1[index]) { 403 + ehea_info("Unable to allocate enough skb in the array\n"); 403 404 pr->rq1_skba.os_skbs = fill_wqes - i; 404 405 break; 405 406 } ··· 423 422 struct net_device *dev = pr->port->netdev; 424 423 int i; 425 424 426 - for (i = 0; i < pr->rq1_skba.len; i++) { 425 + if (nr_rq1a > pr->rq1_skba.len) { 426 + ehea_error("NR_RQ1A bigger than skb array len\n"); 427 + return; 428 + } 429 + 430 + for (i = 0; i < nr_rq1a; i++) { 427 431 skb_arr_rq1[i] = netdev_alloc_skb(dev, EHEA_L_PKT_SIZE); 428 - if (!skb_arr_rq1[i]) 432 + if (!skb_arr_rq1[i]) { 433 + ehea_info("No enough memory to allocate skb array\n"); 429 434 break; 435 + } 430 436 } 431 437 /* Ring doorbell */ 432 - ehea_update_rq1a(pr->qp, nr_rq1a); 438 + ehea_update_rq1a(pr->qp, i); 433 439 } 434 440 435 441 static int ehea_refill_rq_def(struct ehea_port_res *pr, ··· 743 735 744 736 skb = netdev_alloc_skb(dev, 745 737 EHEA_L_PKT_SIZE); 746 - if (!skb) 738 + if (!skb) { 739 + ehea_info("Not enough memory to allocate skb\n"); 747 740 break; 741 + } 748 742 } 749 743 skb_copy_to_linear_data(skb, ((char *)cqe) + 64, 750 744 cqe->num_bytes_transfered - 4);