Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5c7e57f7 authored by Breno Leitao's avatar Breno Leitao Committed by David S. Miller
Browse files

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: default avatarBreno Leitao <leitao@linux.vnet.ibm.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 8e65c0ec
Loading
Loading
Loading
Loading
+14 −4
Original line number Original line Diff line number Diff line
@@ -400,6 +400,7 @@ static void ehea_refill_rq1(struct ehea_port_res *pr, int index, int nr_of_wqes)
			skb_arr_rq1[index] = netdev_alloc_skb(dev,
			skb_arr_rq1[index] = netdev_alloc_skb(dev,
							      EHEA_L_PKT_SIZE);
							      EHEA_L_PKT_SIZE);
			if (!skb_arr_rq1[index]) {
			if (!skb_arr_rq1[index]) {
				ehea_info("Unable to allocate enough skb in the array\n");
				pr->rq1_skba.os_skbs = fill_wqes - i;
				pr->rq1_skba.os_skbs = fill_wqes - i;
				break;
				break;
			}
			}
@@ -422,13 +423,20 @@ static void ehea_init_fill_rq1(struct ehea_port_res *pr, int nr_rq1a)
	struct net_device *dev = pr->port->netdev;
	struct net_device *dev = pr->port->netdev;
	int i;
	int i;


	for (i = 0; i < pr->rq1_skba.len; i++) {
	if (nr_rq1a > pr->rq1_skba.len) {
		ehea_error("NR_RQ1A bigger than skb array len\n");
		return;
	}

	for (i = 0; i < nr_rq1a; i++) {
		skb_arr_rq1[i] = netdev_alloc_skb(dev, EHEA_L_PKT_SIZE);
		skb_arr_rq1[i] = netdev_alloc_skb(dev, EHEA_L_PKT_SIZE);
		if (!skb_arr_rq1[i])
		if (!skb_arr_rq1[i]) {
			ehea_info("No enough memory to allocate skb array\n");
			break;
			break;
		}
		}
	}
	/* Ring doorbell */
	/* Ring doorbell */
	ehea_update_rq1a(pr->qp, nr_rq1a);
	ehea_update_rq1a(pr->qp, i);
}
}


static int ehea_refill_rq_def(struct ehea_port_res *pr,
static int ehea_refill_rq_def(struct ehea_port_res *pr,
@@ -735,9 +743,11 @@ static int ehea_proc_rwqes(struct net_device *dev,


					skb = netdev_alloc_skb(dev,
					skb = netdev_alloc_skb(dev,
							       EHEA_L_PKT_SIZE);
							       EHEA_L_PKT_SIZE);
					if (!skb)
					if (!skb) {
						ehea_info("Not enough memory to allocate skb\n");
						break;
						break;
					}
					}
				}
				skb_copy_to_linear_data(skb, ((char *)cqe) + 64,
				skb_copy_to_linear_data(skb, ((char *)cqe) + 64,
						 cqe->num_bytes_transfered - 4);
						 cqe->num_bytes_transfered - 4);
				ehea_fill_skb(dev, skb, cqe);
				ehea_fill_skb(dev, skb, cqe);