diff options
author | Thomas Klein <tklein@de.ibm.com> | 2009-01-21 17:45:57 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-01-21 17:45:57 -0500 |
commit | e2878806227d223467f84f900ef4c6733ee166df (patch) | |
tree | 6647618897ee003a065684aa80a96f58a99cb37e /drivers/net/ehea/ehea_main.c | |
parent | 3faf2693bd6800c2521799f6a9ae174d9f080ed2 (diff) |
ehea: Improve driver behaviour in low mem conditions
Reworked receive queue fill policies to make the driver more tolerant
in low memory conditions.
Signed-off-by: Thomas Klein <tklein@de.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ehea/ehea_main.c')
-rw-r--r-- | drivers/net/ehea/ehea_main.c | 31 |
1 files changed, 12 insertions, 19 deletions
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c index dfcdd7f21c78..19fccca74ce0 100644 --- a/drivers/net/ehea/ehea_main.c +++ b/drivers/net/ehea/ehea_main.c | |||
@@ -370,8 +370,6 @@ static void ehea_refill_rq1(struct ehea_port_res *pr, int index, int nr_of_wqes) | |||
370 | EHEA_L_PKT_SIZE); | 370 | EHEA_L_PKT_SIZE); |
371 | if (!skb_arr_rq1[index]) { | 371 | if (!skb_arr_rq1[index]) { |
372 | pr->rq1_skba.os_skbs = fill_wqes - i; | 372 | pr->rq1_skba.os_skbs = fill_wqes - i; |
373 | ehea_error("%s: no mem for skb/%d wqes filled", | ||
374 | dev->name, i); | ||
375 | break; | 373 | break; |
376 | } | 374 | } |
377 | } | 375 | } |
@@ -387,26 +385,19 @@ static void ehea_refill_rq1(struct ehea_port_res *pr, int index, int nr_of_wqes) | |||
387 | ehea_update_rq1a(pr->qp, adder); | 385 | ehea_update_rq1a(pr->qp, adder); |
388 | } | 386 | } |
389 | 387 | ||
390 | static int ehea_init_fill_rq1(struct ehea_port_res *pr, int nr_rq1a) | 388 | static void ehea_init_fill_rq1(struct ehea_port_res *pr, int nr_rq1a) |
391 | { | 389 | { |
392 | int ret = 0; | ||
393 | struct sk_buff **skb_arr_rq1 = pr->rq1_skba.arr; | 390 | struct sk_buff **skb_arr_rq1 = pr->rq1_skba.arr; |
394 | struct net_device *dev = pr->port->netdev; | 391 | struct net_device *dev = pr->port->netdev; |
395 | int i; | 392 | int i; |
396 | 393 | ||
397 | for (i = 0; i < pr->rq1_skba.len; i++) { | 394 | for (i = 0; i < pr->rq1_skba.len; i++) { |
398 | skb_arr_rq1[i] = netdev_alloc_skb(dev, EHEA_L_PKT_SIZE); | 395 | skb_arr_rq1[i] = netdev_alloc_skb(dev, EHEA_L_PKT_SIZE); |
399 | if (!skb_arr_rq1[i]) { | 396 | if (!skb_arr_rq1[i]) |
400 | ehea_error("%s: no mem for skb/%d wqes filled", | 397 | break; |
401 | dev->name, i); | ||
402 | ret = -ENOMEM; | ||
403 | goto out; | ||
404 | } | ||
405 | } | 398 | } |
406 | /* Ring doorbell */ | 399 | /* Ring doorbell */ |
407 | ehea_update_rq1a(pr->qp, nr_rq1a); | 400 | ehea_update_rq1a(pr->qp, nr_rq1a); |
408 | out: | ||
409 | return ret; | ||
410 | } | 401 | } |
411 | 402 | ||
412 | static int ehea_refill_rq_def(struct ehea_port_res *pr, | 403 | static int ehea_refill_rq_def(struct ehea_port_res *pr, |
@@ -435,10 +426,12 @@ static int ehea_refill_rq_def(struct ehea_port_res *pr, | |||
435 | u64 tmp_addr; | 426 | u64 tmp_addr; |
436 | struct sk_buff *skb = netdev_alloc_skb(dev, packet_size); | 427 | struct sk_buff *skb = netdev_alloc_skb(dev, packet_size); |
437 | if (!skb) { | 428 | if (!skb) { |
438 | ehea_error("%s: no mem for skb/%d wqes filled", | ||
439 | pr->port->netdev->name, i); | ||
440 | q_skba->os_skbs = fill_wqes - i; | 429 | q_skba->os_skbs = fill_wqes - i; |
441 | ret = -ENOMEM; | 430 | if (q_skba->os_skbs == q_skba->len - 2) { |
431 | ehea_info("%s: rq%i ran dry - no mem for skb", | ||
432 | pr->port->netdev->name, rq_nr); | ||
433 | ret = -ENOMEM; | ||
434 | } | ||
442 | break; | 435 | break; |
443 | } | 436 | } |
444 | skb_reserve(skb, NET_IP_ALIGN); | 437 | skb_reserve(skb, NET_IP_ALIGN); |
@@ -1201,11 +1194,11 @@ static int ehea_fill_port_res(struct ehea_port_res *pr) | |||
1201 | int ret; | 1194 | int ret; |
1202 | struct ehea_qp_init_attr *init_attr = &pr->qp->init_attr; | 1195 | struct ehea_qp_init_attr *init_attr = &pr->qp->init_attr; |
1203 | 1196 | ||
1204 | ret = ehea_init_fill_rq1(pr, init_attr->act_nr_rwqes_rq1 | 1197 | ehea_init_fill_rq1(pr, init_attr->act_nr_rwqes_rq1 |
1205 | - init_attr->act_nr_rwqes_rq2 | 1198 | - init_attr->act_nr_rwqes_rq2 |
1206 | - init_attr->act_nr_rwqes_rq3 - 1); | 1199 | - init_attr->act_nr_rwqes_rq3 - 1); |
1207 | 1200 | ||
1208 | ret |= ehea_refill_rq2(pr, init_attr->act_nr_rwqes_rq2 - 1); | 1201 | ret = ehea_refill_rq2(pr, init_attr->act_nr_rwqes_rq2 - 1); |
1209 | 1202 | ||
1210 | ret |= ehea_refill_rq3(pr, init_attr->act_nr_rwqes_rq3 - 1); | 1203 | ret |= ehea_refill_rq3(pr, init_attr->act_nr_rwqes_rq3 - 1); |
1211 | 1204 | ||