Subject: Re: [PATCH net 3/4] IB/mlx4: Saturate RoCE port PMA counters in case of overflow

From: Sergei Shtylyov <[email-masked]>
Date: Wed, 18 Mar 2015 17:36:31 +0300

Hello.

On 3/18/2015 5:24 PM, Or Gerlitz wrote:

> From: Majd Dibbiny <[email-masked]>

> For RoCE ports, we set the u32 PMA values based on u64 HCA counters. In case of
> overflow, according to the IB spec, we have to saturate a counter to its
> max value, do that.

> Fixes: c37791349cc7 ('IB/mlx4: Support PMA counters for IBoE')
> Signed-off-by: Majd Dibbiny <[email-masked]>
> Signed-off-by: Eran Ben Elisha <[email-masked]>
> Signed-off-by: Hadar Hen Zion <[email-masked]>
> Signed-off-by: Or Gerlitz <[email-masked]>
> ---
>   drivers/infiniband/hw/mlx4/mad.c |   23 +++++++++++++++++++----
>   1 files changed, 19 insertions(+), 4 deletions(-)

> diff --git a/drivers/infiniband/hw/mlx4/mad.c b/drivers/infiniband/hw/mlx4/mad.c
> index c761971..40850f1 100644
> --- a/drivers/infiniband/hw/mlx4/mad.c
> +++ b/drivers/infiniband/hw/mlx4/mad.c
> @@ -64,6 +64,17 @@ enum {
>   #define GUID_TBL_BLK_NUM_ENTRIES 8
>   #define GUID_TBL_BLK_SIZE (GUID_TBL_ENTRY_SIZE * GUID_TBL_BLK_NUM_ENTRIES)
>
> +#define MAX_BE32 0xffffffffULL
> +#define MAX_BE16 0xffffUL

    Aren't U{16|32}_MAX from <linux/kernel.h> good enough?
    And I'm not seeing wheer MAX_BE16 is used...

[...]

WBR, Sergei