diff options
-rw-r--r-- | drivers/net/ehea/ehea_main.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c index 182b2a7be8dc..3d0af08483a1 100644 --- a/drivers/net/ehea/ehea_main.c +++ b/drivers/net/ehea/ehea_main.c | |||
@@ -400,6 +400,7 @@ static void ehea_refill_rq1(struct ehea_port_res *pr, int index, int nr_of_wqes) | |||
400 | skb_arr_rq1[index] = netdev_alloc_skb(dev, | 400 | skb_arr_rq1[index] = netdev_alloc_skb(dev, |
401 | EHEA_L_PKT_SIZE); | 401 | EHEA_L_PKT_SIZE); |
402 | if (!skb_arr_rq1[index]) { | 402 | if (!skb_arr_rq1[index]) { |
403 | ehea_info("Unable to allocate enough skb in the array\n"); | ||
403 | pr->rq1_skba.os_skbs = fill_wqes - i; | 404 | pr->rq1_skba.os_skbs = fill_wqes - i; |
404 | break; | 405 | break; |
405 | } | 406 | } |
@@ -422,13 +423,20 @@ static void ehea_init_fill_rq1(struct ehea_port_res *pr, int nr_rq1a) | |||
422 | struct net_device *dev = pr->port->netdev; | 423 | struct net_device *dev = pr->port->netdev; |
423 | int i; | 424 | int i; |
424 | 425 | ||
425 | for (i = 0; i < pr->rq1_skba.len; i++) { | 426 | if (nr_rq1a > pr->rq1_skba.len) { |
427 | ehea_error("NR_RQ1A bigger than skb array len\n"); | ||
428 | return; | ||
429 | } | ||
430 | |||
431 | for (i = 0; i < nr_rq1a; i++) { | ||
426 | skb_arr_rq1[i] = netdev_alloc_skb(dev, EHEA_L_PKT_SIZE); | 432 | skb_arr_rq1[i] = netdev_alloc_skb(dev, EHEA_L_PKT_SIZE); |
427 | if (!skb_arr_rq1[i]) | 433 | if (!skb_arr_rq1[i]) { |
434 | ehea_info("No enough memory to allocate skb array\n"); | ||
428 | break; | 435 | break; |
436 | } | ||
429 | } | 437 | } |
430 | /* Ring doorbell */ | 438 | /* Ring doorbell */ |
431 | ehea_update_rq1a(pr->qp, nr_rq1a); | 439 | ehea_update_rq1a(pr->qp, i); |
432 | } | 440 | } |
433 | 441 | ||
434 | static int ehea_refill_rq_def(struct ehea_port_res *pr, | 442 | static int ehea_refill_rq_def(struct ehea_port_res *pr, |
@@ -735,8 +743,10 @@ static int ehea_proc_rwqes(struct net_device *dev, | |||
735 | 743 | ||
736 | skb = netdev_alloc_skb(dev, | 744 | skb = netdev_alloc_skb(dev, |
737 | EHEA_L_PKT_SIZE); | 745 | EHEA_L_PKT_SIZE); |
738 | if (!skb) | 746 | if (!skb) { |
747 | ehea_info("Not enough memory to allocate skb\n"); | ||
739 | break; | 748 | break; |
749 | } | ||
740 | } | 750 | } |
741 | skb_copy_to_linear_data(skb, ((char *)cqe) + 64, | 751 | skb_copy_to_linear_data(skb, ((char *)cqe) + 64, |
742 | cqe->num_bytes_transfered - 4); | 752 | cqe->num_bytes_transfered - 4); |