diff mbox

ehea: Add some info messages and fix an issue

Message ID 1290788771-10019-1-git-send-email-leitao@linux.vnet.ibm.com
State Superseded, archived
Delegated to: David Miller
Headers show

Commit Message

Breno Leitao Nov. 26, 2010, 4:26 p.m. UTC
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>
---
 drivers/net/ehea/ehea_main.c |   20 ++++++++++++++++----
 1 files changed, 16 insertions(+), 4 deletions(-)

Comments

Joe Perches Nov. 26, 2010, 5:01 p.m. UTC | #1
On Fri, 2010-11-26 at 14:26 -0200, leitao@linux.vnet.ibm.com wrote:
> This patch adds some debug information about ehea not being able to
> allocate enough spaces. Also it correctly updates the amount of available
> skb.

This patch introduces unnecessary whitespace into the logging messages.

> Signed-off-by: Breno Leitao <leitao@linux.vnet.ibm.com>
[]
> diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c
[]
> @@ -400,6 +400,8 @@ static void ehea_refill_rq1(struct ehea_port_res *pr, int index, int nr_of_wqes)
>  			skb_arr_rq1[index] = netdev_alloc_skb(dev,
>  							      EHEA_L_PKT_SIZE);
>  			if (!skb_arr_rq1[index]) {
> +				ehea_info("Unable to allocate enough skb in
> +					   the array\n");

Don't split up the message into multiple lines like this.
Either just use a single line like:

				ehea_info("Unable to allocate enough skb in the array\n");

and ignore 80 column line lengths, or break up the line into
quoted parts:

				ehea_info("Unable to allocate enough skb in"
					  "the array\n");

The first option is preferred to make grepping easier.

[]

> @@ -735,8 +744,11 @@ static int ehea_proc_rwqes(struct net_device *dev,
>  
>  					skb = netdev_alloc_skb(dev,
>  							       EHEA_L_PKT_SIZE);
> -					if (!skb)
> +					if (!skb) {
> +						ehea_info("Not enough memory to
> +							   allocate skb\n");

here too


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c
index 182b2a7..a70457b 100644
--- a/drivers/net/ehea/ehea_main.c
+++ b/drivers/net/ehea/ehea_main.c
@@ -400,6 +400,8 @@  static void ehea_refill_rq1(struct ehea_port_res *pr, int index, int nr_of_wqes)
 			skb_arr_rq1[index] = netdev_alloc_skb(dev,
 							      EHEA_L_PKT_SIZE);
 			if (!skb_arr_rq1[index]) {
+				ehea_info("Unable to allocate enough skb in
+					   the array\n");
 				pr->rq1_skba.os_skbs = fill_wqes - i;
 				break;
 			}
@@ -422,13 +424,20 @@  static void ehea_init_fill_rq1(struct ehea_port_res *pr, int nr_rq1a)
 	struct net_device *dev = pr->port->netdev;
 	int i;
 
-	for (i = 0; i < pr->rq1_skba.len; i++) {
+	if (nr_rq1a > pr->rq1_skba.len) {
+		ehea_error("NR_RQ1A is 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);
-		if (!skb_arr_rq1[i])
+		if (!skb_arr_rq1[i]) {
+			ehea_info("Not enough memory to allocate skb array\n");
 			break;
+		}
 	}
 	/* 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,
@@ -735,8 +744,11 @@  static int ehea_proc_rwqes(struct net_device *dev,
 
 					skb = netdev_alloc_skb(dev,
 							       EHEA_L_PKT_SIZE);
-					if (!skb)
+					if (!skb) {
+						ehea_info("Not enough memory to
+							   allocate skb\n");
 						break;
+					}
 				}
 				skb_copy_to_linear_data(skb, ((char *)cqe) + 64,
 						 cqe->num_bytes_transfered - 4);