public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* bnx2x - bnx2x_credit_pool_get_entry bug?
@ 2012-03-27  5:14 Maciej Żenczykowski
  2012-03-27  6:58 ` Dmitry Kravkov
  0 siblings, 1 reply; 3+ messages in thread
From: Maciej Żenczykowski @ 2012-03-27  5:14 UTC (permalink / raw)
  To: Linux NetDev, Vlad Zolotarov; +Cc: Maciej Żenczykowski

drivers/net/bnx2x/bnx2x_sp.c:3850 contains in bnx2x_credit_pool_get_entry():

last modified in commit: 619c5cb6885b9 Vlad Zolotarov      2011-06-14
14:33:44 +0300

static bool bnx2x_credit_pool_get_entry(
        struct bnx2x_credit_pool_obj *o,
        int *offset)
{
        int idx, vec, i;

        *offset = -1;

        /* Find "internal cam-offset" then add to base for this object... */
        for (vec = 0; vec < BNX2X_POOL_VEC_SIZE; vec++) {

                /* Skip the current vector if there are no free entries in it */
                if (!o->pool_mirror[vec])
                        continue;

                /* If we've got here we are going to find a free entry */
                for (idx = vec * BNX2X_POOL_VEC_SIZE, i = 0;
                      i < BIT_VEC64_ELEM_SZ; idx++, i++)

                        if (BIT_VEC64_TEST_BIT(o->pool_mirror, idx)) {
                                /* Got one!! */
                                BIT_VEC64_CLEAR_BIT(o->pool_mirror, idx);
                                *offset = o->base_pool_offset + idx;
                                return true;
                        }
        }

        return false;
}

drivers/net/ethernet/broadcom/bnx2x/bnx2x_fw_defs.h:301:#define
MAX_MAC_CREDIT_E2 272 /* Per Path */
drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.h:640:#define
BNX2X_POOL_VEC_SIZE  (MAX_MAC_CREDIT_E2 / 64)
drivers/net/ethernet/broadcom/bnx2x/bnx2x.h:385:#define
BIT_VEC64_ELEM_SZ               64

looks to me like idx = vec * BNX2X_POOL_VEC_SIZE should actually be
idx = vec * BIT_VEC64_ELEM_SZ

Found this while trying to debug an E1 multicast problem in an older
bnx2x driver and looking upstream for inspiration.

- Maciej

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: bnx2x - bnx2x_credit_pool_get_entry bug?
  2012-03-27  5:14 bnx2x - bnx2x_credit_pool_get_entry bug? Maciej Żenczykowski
@ 2012-03-27  6:58 ` Dmitry Kravkov
  2012-03-27 22:55   ` Maciej Żenczykowski
  0 siblings, 1 reply; 3+ messages in thread
From: Dmitry Kravkov @ 2012-03-27  6:58 UTC (permalink / raw)
  To: Maciej Żenczykowski; +Cc: Linux NetDev, Maciej Żenczykowski

On Mon, 2012-03-26 at 22:14 -0700, Maciej Żenczykowski wrote:

> looks to me like idx = vec * BNX2X_POOL_VEC_SIZE should actually be
> idx = vec * BIT_VEC64_ELEM_SZ
> 

This is correct! Thank you, Maciej. The patch is coming ...

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: bnx2x - bnx2x_credit_pool_get_entry bug?
  2012-03-27  6:58 ` Dmitry Kravkov
@ 2012-03-27 22:55   ` Maciej Żenczykowski
  0 siblings, 0 replies; 3+ messages in thread
From: Maciej Żenczykowski @ 2012-03-27 22:55 UTC (permalink / raw)
  To: Dmitry Kravkov; +Cc: Linux NetDev

On Mon, Mar 26, 2012 at 11:58 PM, Dmitry Kravkov <dmitry@broadcom.com> wrote:
> On Mon, 2012-03-26 at 22:14 -0700, Maciej Żenczykowski wrote:
>
>> looks to me like idx = vec * BNX2X_POOL_VEC_SIZE should actually be
>> idx = vec * BIT_VEC64_ELEM_SZ
>>
>
> This is correct! Thank you, Maciej. The patch is coming ...

Thanks.

-- 
Maciej A. Żenczykowski
Kernel Networking Developer @ Google
1600 Amphitheatre Parkway, Mountain View, CA 94043
tel: +1 (650) 253-0062

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-03-27 22:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-27  5:14 bnx2x - bnx2x_credit_pool_get_entry bug? Maciej Żenczykowski
2012-03-27  6:58 ` Dmitry Kravkov
2012-03-27 22:55   ` Maciej Żenczykowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox