ehea: Add some info messages and fix an issue
Subsystems (2)
PATCH 1/1 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.
--- drivers/net/ehea/ehea_main.c | 20 ++++++++++++++++---- 1 files changed, 16 insertions(+), 4 deletions(-)
drivers/net/ehea/ehea_main.c +16 -4
@@ -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);
Signature · 1 line
1.7.1
Quoted 3 lines · On Fri, 2010-11-26 at 14:26 -0200, [email protected] 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.
Quoted 1 line
Signed-off-by Breno Leitao <[email protected]>
[]
drivers/net/ehea/ehea_main.c
Quoted 1 line
drivers/net/ehea/ehea_main.c +0
-0
[]
drivers/net/ehea/ehea_main.c static void ehea_refill_rq1(struct ehea_port_res *pr, int index, int nr_of_wqes) · line 404
Quoted 6 lines
drivers/net/ehea/ehea_main.c +2
-0@@ -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.
[]
drivers/net/ehea/ehea_main.c static int ehea_proc_rwqes(struct net_device *dev, · line 749
Quoted 8 lines
drivers/net/ehea/ehea_main.c +3
-1@@ -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
PATCH 1/1 ehea: Add some info messages and fix an issue
From: Breno Leitao <breno@cafe.(none)>
This patch adds some debug information about ehea not being able to allocate enough spaces. Also it correctly updates the amount of available skb.
--- drivers/net/ehea/ehea_main.c | 18 ++++++++++++++---- 1 files changed, 14 insertions(+), 4 deletions(-)
drivers/net/ehea/ehea_main.c +14 -4
@@ -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,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 +423,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 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 ("No 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 +743,10 @@ 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 );
Signature · 1 line
1.7.1
PATCH 1/1 ehea: Use the standard logging functions
Remove ehea_error, ehea_info and ehea_debug macros.
Use pr_fmt, pr_<level>, netdev_<level> and netif_<level> as appropriate. Fix messages to use trailing "\n", some messages had an extra one as the old ehea_<level> macros added a trailing "\n". Coalesced long format strings.
Uncompiled/untested.
--- drivers/net/ehea/ehea.h | 13 -- drivers/net/ehea/ehea_ethtool.c | 18 +- drivers/net/ehea/ehea_main.c | 415 +++++++++++++++++++-------------------- drivers/net/ehea/ehea_phyp.c | 40 ++-- drivers/net/ehea/ehea_qmr.c | 89 +++++---- 5 files changed, 278 insertions(+), 297 deletions(-)
drivers/net/ehea/ehea.h +0 -13
@@ -130,19 +130,6 @@/* utility functions */ -#define ehea_info(fmt, args...) \ - printk(KERN_INFO DRV_NAME ": " fmt "\n", ## args) - -#define ehea_error(fmt, args...) \ - printk(KERN_ERR DRV_NAME ": Error in %s: " fmt "\n", __func__, ## args) - -#ifdef DEBUG -#define ehea_debug(fmt, args...) \ - printk(KERN_DEBUG DRV_NAME ": " fmt, ## args) -#else -#define ehea_debug(fmt, args...) do {} while (0) -#endif -void ehea_dump (void *adr,int len,char *msg);#define EHEA_BMASK (pos, length) (((pos) << 16) + (length))
drivers/net/ehea/ehea_ethtool.c +10 -8
@@ -26,6 +26,8 @@* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include "ehea.h" #include "ehea_phyp.h"
@@ -118,10 +120,10 @@ doit: ret =ehea_set_portspeed (port, sp);if (!ret) -ehea_info ("%s: Port speed successfully set: %dMbps " -"%s Duplex" , - port->netdev->name, port->port_speed, - port->full_duplex ==1 ?"Full" :"Half" ); +netdev_info (dev, +"Port speed successfully set: %dMbps %s Duplex\n" , + port->port_speed, + port->full_duplex ==1 ?"Full" :"Half" ); out:return ret; }
@@ -134,10 +136,10 @@ static int ehea_nway_reset(struct net_device *dev) ret =ehea_set_portspeed (port,EHEA_SPEED_AUTONEG );if (!ret) -ehea_info ("%s: Port speed successfully set: %dMbps " -"%s Duplex" , - port->netdev->name, port->port_speed, - port->full_duplex ==1 ?"Full" :"Half" ); +netdev_info (port->netdev, +"Port speed successfully set: %dMbps %s Duplex\n" , + port->port_speed, + port->full_duplex ==1 ?"Full" :"Half" );return ret; }
drivers/net/ehea/ehea_main.c +203 -212
1,153 lines not on this page · raw message
drivers/net/ehea/ehea_phyp.c +20 -20
@@ -26,6 +26,8 @@* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include "ehea_phyp.h"
@@ -67,12 +69,11 @@ static long ehea_plpar_hcall_norets(unsigned long opcode, }if (ret <H_SUCCESS ) -ehea_error ("opcode=%lx ret=%lx" -" arg1=%lx arg2=%lx arg3=%lx arg4=%lx" -" arg5=%lx arg6=%lx arg7=%lx " , - opcode, ret, - arg1, arg2, arg3, arg4, arg5, - arg6, arg7); +pr_err ("opcode=%lx ret=%lx" +" arg1=%lx arg2=%lx arg3=%lx arg4=%lx" +" arg5=%lx arg6=%lx arg7=%lx\n" , + opcode, ret, + arg1, arg2, arg3, arg4, arg5, arg6, arg7);return ret; }
@@ -114,19 +115,18 @@ static long ehea_plpar_hcall9(unsigned long opcode, && (((cb_cat == H_PORT_CB4) && ((arg3 == H_PORT_CB4_JUMBO) || (arg3 == H_PORT_CB4_SPEED))) || ((cb_cat == H_PORT_CB7) && (arg3 == H_PORT_CB7_DUCQPN))))) -ehea_error ("opcode=%lx ret=%lx" -" arg1=%lx arg2=%lx arg3=%lx arg4=%lx" -" arg5=%lx arg6=%lx arg7=%lx arg8=%lx" -" arg9=%lx" -" out1=%lx out2=%lx out3=%lx out4=%lx" -" out5=%lx out6=%lx out7=%lx out8=%lx" -" out9=%lx" , - opcode, ret, - arg1, arg2, arg3, arg4, arg5, - arg6, arg7, arg8, arg9, - outs[0 ], outs[1 ], outs[2 ], outs[3 ], - outs[4 ], outs[5 ], outs[6 ], outs[7 ], - outs[8 ]); +pr_err ("opcode=%lx ret=%lx" +" arg1=%lx arg2=%lx arg3=%lx arg4=%lx" +" arg5=%lx arg6=%lx arg7=%lx arg8=%lx" +" arg9=%lx" +" out1=%lx out2=%lx out3=%lx out4=%lx" +" out5=%lx out6=%lx out7=%lx out8=%lx" +" out9=%lx\n" , + opcode, ret, + arg1, arg2, arg3, arg4, arg5, + arg6, arg7, arg8, arg9, + outs[0 ], outs[1 ], outs[2 ], outs[3 ], outs[4 ], + outs[5 ], outs[6 ], outs[7 ], outs[8 ]);return ret; }
@@ -515,7 +515,7 @@ u64 ehea_h_register_rpage_mr(const u64 adapter_handle, const u64 mr_handle, const u64 log_pageaddr, const u64 count) { if ((count > 1) && (log_pageaddr & ~PAGE_MASK)) { - ehea_error("not on pageboundary"); + pr_err("not on pageboundary\n"); return H_PARAMETER; }
drivers/net/ehea/ehea_qmr.c +45 -44
294 lines not on this page · raw message
Re: [PATCH] ehea: Use the standard logging functions
Joe,
Thanks for the patch. Please make sure that it applies over the last Davem's tree. He just committed one patch that will probably conflict with this patch.
Also, this patch is printing:
ibmebus port0: foobarmessage
Instead of
ehea: foobarmessage
But this is a driver issue, and your patch just exposed this problem. I will send a patch for this soon.
Thanks
Breno
Quoted 9 lines · Joe Perches
Remove
ehea_error,ehea_infoandehea_debugmacros.
Usepr_fmt, pr_<level>, netdev_<level> and netif_<level> as appropriate. Fix messages to use trailing "\n", some messages had an extra one as the old ehea_<level> macros added a trailing "\n". Coalesced long format strings.Uncompiled/untested.
Signed-off-by Joe Perches<[email protected]>
PATCH v2 1/1 ehea: Use the standard logging functions
Remove ehea_error, ehea_info and ehea_debug macros.
Use pr_fmt, pr_<level>, netdev_<level> and netif_<level> as appropriate. Fix messages to use trailing "\n", some messages had an extra one as the old ehea_<level> macros added a trailing "\n". Coalesced long format strings.
Uncompiled/untested.
---
v2: Update to current net-next
drivers/net/ehea/ehea.h | 13 -- drivers/net/ehea/ehea_ethtool.c | 18 +- drivers/net/ehea/ehea_main.c | 407 +++++++++++++++++++-------------------- drivers/net/ehea/ehea_phyp.c | 40 ++-- drivers/net/ehea/ehea_qmr.c | 89 +++++----- 5 files changed, 274 insertions(+), 293 deletions(-)
drivers/net/ehea/ehea.h +0 -13
@@ -130,19 +130,6 @@/* utility functions */ -#define ehea_info(fmt, args...) \ - printk(KERN_INFO DRV_NAME ": " fmt "\n", ## args) - -#define ehea_error(fmt, args...) \ - printk(KERN_ERR DRV_NAME ": Error in %s: " fmt "\n", __func__, ## args) - -#ifdef DEBUG -#define ehea_debug(fmt, args...) \ - printk(KERN_DEBUG DRV_NAME ": " fmt, ## args) -#else -#define ehea_debug(fmt, args...) do {} while (0) -#endif -void ehea_dump (void *adr,int len,char *msg);#define EHEA_BMASK (pos, length) (((pos) << 16) + (length))
drivers/net/ehea/ehea_ethtool.c +10 -8
@@ -26,6 +26,8 @@* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include "ehea.h" #include "ehea_phyp.h"
@@ -118,10 +120,10 @@ doit: ret =ehea_set_portspeed (port, sp);if (!ret) -ehea_info ("%s: Port speed successfully set: %dMbps " -"%s Duplex" , - port->netdev->name, port->port_speed, - port->full_duplex ==1 ?"Full" :"Half" ); +netdev_info (dev, +"Port speed successfully set: %dMbps %s Duplex\n" , + port->port_speed, + port->full_duplex ==1 ?"Full" :"Half" ); out:return ret; }
@@ -134,10 +136,10 @@ static int ehea_nway_reset(struct net_device *dev) ret =ehea_set_portspeed (port,EHEA_SPEED_AUTONEG );if (!ret) -ehea_info ("%s: Port speed successfully set: %dMbps " -"%s Duplex" , - port->netdev->name, port->port_speed, - port->full_duplex ==1 ?"Full" :"Half" ); +netdev_info (port->netdev, +"Port speed successfully set: %dMbps %s Duplex\n" , + port->port_speed, + port->full_duplex ==1 ?"Full" :"Half" );return ret; }
drivers/net/ehea/ehea_main.c +199 -208
1,123 lines not on this page · raw message
drivers/net/ehea/ehea_phyp.c +20 -20
@@ -26,6 +26,8 @@* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include "ehea_phyp.h"
@@ -67,12 +69,11 @@ static long ehea_plpar_hcall_norets(unsigned long opcode, }if (ret <H_SUCCESS ) -ehea_error ("opcode=%lx ret=%lx" -" arg1=%lx arg2=%lx arg3=%lx arg4=%lx" -" arg5=%lx arg6=%lx arg7=%lx " , - opcode, ret, - arg1, arg2, arg3, arg4, arg5, - arg6, arg7); +pr_err ("opcode=%lx ret=%lx" +" arg1=%lx arg2=%lx arg3=%lx arg4=%lx" +" arg5=%lx arg6=%lx arg7=%lx\n" , + opcode, ret, + arg1, arg2, arg3, arg4, arg5, arg6, arg7);return ret; }
@@ -114,19 +115,18 @@ static long ehea_plpar_hcall9(unsigned long opcode, && (((cb_cat == H_PORT_CB4) && ((arg3 == H_PORT_CB4_JUMBO) || (arg3 == H_PORT_CB4_SPEED))) || ((cb_cat == H_PORT_CB7) && (arg3 == H_PORT_CB7_DUCQPN))))) -ehea_error ("opcode=%lx ret=%lx" -" arg1=%lx arg2=%lx arg3=%lx arg4=%lx" -" arg5=%lx arg6=%lx arg7=%lx arg8=%lx" -" arg9=%lx" -" out1=%lx out2=%lx out3=%lx out4=%lx" -" out5=%lx out6=%lx out7=%lx out8=%lx" -" out9=%lx" , - opcode, ret, - arg1, arg2, arg3, arg4, arg5, - arg6, arg7, arg8, arg9, - outs[0 ], outs[1 ], outs[2 ], outs[3 ], - outs[4 ], outs[5 ], outs[6 ], outs[7 ], - outs[8 ]); +pr_err ("opcode=%lx ret=%lx" +" arg1=%lx arg2=%lx arg3=%lx arg4=%lx" +" arg5=%lx arg6=%lx arg7=%lx arg8=%lx" +" arg9=%lx" +" out1=%lx out2=%lx out3=%lx out4=%lx" +" out5=%lx out6=%lx out7=%lx out8=%lx" +" out9=%lx\n" , + opcode, ret, + arg1, arg2, arg3, arg4, arg5, + arg6, arg7, arg8, arg9, + outs[0 ], outs[1 ], outs[2 ], outs[3 ], outs[4 ], + outs[5 ], outs[6 ], outs[7 ], outs[8 ]);return ret; }
@@ -515,7 +515,7 @@ u64 ehea_h_register_rpage_mr(const u64 adapter_handle, const u64 mr_handle, const u64 log_pageaddr, const u64 count) { if ((count > 1) && (log_pageaddr & ~PAGE_MASK)) { - ehea_error("not on pageboundary"); + pr_err("not on pageboundary\n"); return H_PARAMETER; }
drivers/net/ehea/ehea_qmr.c +45 -44
294 lines not on this page · raw message
Re: [net-next PATCH V2] ehea: Use the standard logging functions
Quoted 9 lines · Joe Perches
Remove
ehea_error,ehea_infoandehea_debugmacros.
Usepr_fmt, pr_<level>, netdev_<level> and netif_<level> as appropriate. Fix messages to use trailing "\n", some messages had an extra one as the old ehea_<level> macros added a trailing "\n". Coalesced long format strings.Uncompiled/untested.
Signed-off-by Joe Perches<[email protected]>
Re: [net-next PATCH V2] ehea: Use the standard logging functions
From: Breno Leitao <[email protected]>
Date: Thu, 02 Dec 2010 16:54:58 -0200
Quoted 8 lines · Joe Perches
Quoted 7 lines
Remove
ehea_error,ehea_infoandehea_debugmacros.
Usepr_fmt, pr_<level>, netdev_<level> and netif_<level> as appropriate.
Fix messages to use trailing "\n", some messages had an extra one as the old ehea_<level> macros added a trailing "\n". Coalesced long format strings.
Quoted 4 lines
Quoted 3 lines
Uncompiled/untested.
Signed-off-by Joe Perches<[email protected]>Signed-off-by Breno Leitao<[email protected]>
Applied.
From: [email protected]
Date: Fri, 26 Nov 2010 15:26:27 -0200
Quoted 7 lines
From: Breno Leitao <breno@cafe.(none)>
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 <[email protected]>
Applied to net-2.6
Hi,
Quoted 5 lines
From: Breno Leitao <breno@cafe.(none)>
This patch adds some debug information about ehea not being able to allocate enough spaces. Also it correctly updates the amount of available skb.
I'm seeing issues on a number of machines with the ehea device. Sometime after boot I see a bunch of:
ehea: Error in ehea_proc_rwqes: LL rq1: skb=NULL
ehea: Error in ehea_proc_rwqes: LL rq1: skb=NULL
ehea: Error in ehea_proc_rwqes: LL rq1: skb=NULL
ehea: Error in ehea_proc_rwqes: LL rq1: skb=NULL
which eventually stop.
- for (i = 0; i < pr->rq1_skba.len; i++) {
+ for (i = 0; i < nr_rq1a; i++) {
It looks like you are now only initialising half the ring, but still telling the hardware to use the whole ring. Once you get through the entire ring once the errors go away.
Anton
Hi Anton,
Quoted 3 lines · Anton Blanchard
It looks like you are now only initialising half the ring, but still
telling the hardware to use the whole ring. Once you get through the entire ring once the errors go away.
You are correct. The problem in the past ehea_init_fill_rq1() wasn't respecting the nr_rq1a parameter. So, every time ehea_init_fill_rqX() was trying to allocated the entire skb arrary, and assume that the entire array was allocated, which wasn't correct.
My patch just allocate the requested number of skbs (described in nr_rq1a) in skb array, and tell hea that only that amount of skb were allocated (via doorbell).
On the other side, ehea_proc_rwqes() tries to maximize the array usage, meaning that if the array is not completely used, it'd try to allocate an skb "on-the-fly", and this is expected (For example, when you initialize the system on memory pressure)
That is why I sent another patch that turns this message a netif_info() instead of a netif_error() (as it was in the past). The commit id for this patch is 782615aea84e57dc7f2f922cea823df3de635a78
So, although this behaviour is completely expected, this code path should only being executed on memory pressure. But I am suspecting this code path is execute more often than I'd expect. Let me investigate this.
Thanks
Breno