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