All of lore.kernel.org
 help / color / mirror / Atom feed
* Possible issue with Mellanox be2net/port handling
@ 2012-08-31 12:25 Marcelo Ricardo Leitner
  2012-08-31 12:26 ` Possible issue with Mellanox mlx4/port handling Marcelo Ricardo Leitner
  0 siblings, 1 reply; 6+ messages in thread
From: Marcelo Ricardo Leitner @ 2012-08-31 12:25 UTC (permalink / raw)
  To: netdev; +Cc: dledford

Hi,

Commit 
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=commitdiff;h=4c41b3673759d096106e68bce586f103c51d4119 
inserted changes like:

@@ -361,7 +361,7 @@ static int add_promisc_qp(struct mlx4_dev *dev, u8 port,
         int err;
         struct mlx4_priv *priv = mlx4_priv(dev);

-       s_steer = &mlx4_priv(dev)->steer[0];
+       s_steer = &mlx4_priv(dev)->steer[port - 1];

         mutex_lock(&priv->mcg_table.mutex);

But I fear we missed one part of the deal. Concept patch:

@@ -365,7 +365,7 @@ static int add_promisc_qp(struct mlx4_dev *dev, u8 port,

         mutex_lock(&priv->mcg_table.mutex);

-       if (get_promisc_qp(dev, 0, steer, qpn)) {
+       if (get_promisc_qp(dev, port - 1, steer, qpn)) {
                 err = 0;  /* Noting to do, already exists */
                 goto out_mutex;
         }

Because:

static int add_promisc_qp(struct mlx4_dev *dev, u8 port,
               enum mlx4_steer_type steer, u32 qpn)
{
...
A)  s_steer = &mlx4_priv(dev)->steer[port - 1];

     mutex_lock(&priv->mcg_table.mutex);

     if (get_promisc_qp(dev, 0, steer, qpn)) {
         err = 0;  /* Noting to do, already exists */
         goto out_mutex;
     }
...
     /* add the new qpn to list of promisc qps */
C)  list_add_tail(&pqp->list, &s_steer->promisc_qps[steer]);
...
}

static struct mlx4_promisc_qp *get_promisc_qp(struct mlx4_dev *dev, u8 
pf_num,
                           enum mlx4_steer_type steer,
                           u32 qpn)
{
B)  struct mlx4_steer *s_steer = &mlx4_priv(dev)->steer[pf_num];
     struct mlx4_promisc_qp *pqp;

     list_for_each_entry(pqp, &s_steer->promisc_qps[steer], list) {
         if (pqp->qpn == qpn)
             return pqp;
     }
     /* not found */
     return NULL;
}

As far as I can understand, we are changing a list for a port and 
checking for duplicates on the other list. Points marked as A, B and C 
for highlighting. Am I missing something? What do you think?

FWIW, this call get_promisc_qp(dev, 0, ...) happens in other places too.

Thank you,
Marcelo.

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

* Re: Possible issue with Mellanox mlx4/port handling
  2012-08-31 12:25 Possible issue with Mellanox be2net/port handling Marcelo Ricardo Leitner
@ 2012-08-31 12:26 ` Marcelo Ricardo Leitner
  0 siblings, 0 replies; 6+ messages in thread
From: Marcelo Ricardo Leitner @ 2012-08-31 12:26 UTC (permalink / raw)
  To: netdev; +Cc: dledford

Fixed subject, sorry the confusion.

On 08/31/2012 09:25 AM, Marcelo Ricardo Leitner wrote:
> Hi,
>
> Commit
> http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=commitdiff;h=4c41b3673759d096106e68bce586f103c51d4119
> inserted changes like:
>
> @@ -361,7 +361,7 @@ static int add_promisc_qp(struct mlx4_dev *dev, u8
> port,
> int err;
> struct mlx4_priv *priv = mlx4_priv(dev);
>
> - s_steer = &mlx4_priv(dev)->steer[0];
> + s_steer = &mlx4_priv(dev)->steer[port - 1];
>
> mutex_lock(&priv->mcg_table.mutex);
>
> But I fear we missed one part of the deal. Concept patch:
>
> @@ -365,7 +365,7 @@ static int add_promisc_qp(struct mlx4_dev *dev, u8
> port,
>
> mutex_lock(&priv->mcg_table.mutex);
>
> - if (get_promisc_qp(dev, 0, steer, qpn)) {
> + if (get_promisc_qp(dev, port - 1, steer, qpn)) {
> err = 0; /* Noting to do, already exists */
> goto out_mutex;
> }
>
> Because:
>
> static int add_promisc_qp(struct mlx4_dev *dev, u8 port,
> enum mlx4_steer_type steer, u32 qpn)
> {
> ...
> A) s_steer = &mlx4_priv(dev)->steer[port - 1];
>
> mutex_lock(&priv->mcg_table.mutex);
>
> if (get_promisc_qp(dev, 0, steer, qpn)) {
> err = 0; /* Noting to do, already exists */
> goto out_mutex;
> }
> ...
> /* add the new qpn to list of promisc qps */
> C) list_add_tail(&pqp->list, &s_steer->promisc_qps[steer]);
> ...
> }
>
> static struct mlx4_promisc_qp *get_promisc_qp(struct mlx4_dev *dev, u8
> pf_num,
> enum mlx4_steer_type steer,
> u32 qpn)
> {
> B) struct mlx4_steer *s_steer = &mlx4_priv(dev)->steer[pf_num];
> struct mlx4_promisc_qp *pqp;
>
> list_for_each_entry(pqp, &s_steer->promisc_qps[steer], list) {
> if (pqp->qpn == qpn)
> return pqp;
> }
> /* not found */
> return NULL;
> }
>
> As far as I can understand, we are changing a list for a port and
> checking for duplicates on the other list. Points marked as A, B and C
> for highlighting. Am I missing something? What do you think?
>
> FWIW, this call get_promisc_qp(dev, 0, ...) happens in other places too.
>
> Thank you,
> Marcelo.

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

* Re: Possible issue with Mellanox mlx4/port handling
  2012-09-03 17:51   ` Yevgeny Petrilin
@ 2012-09-03 18:16     ` Marcelo Ricardo Leitner
  0 siblings, 0 replies; 6+ messages in thread
From: Marcelo Ricardo Leitner @ 2012-09-03 18:16 UTC (permalink / raw)
  To: Yevgeny Petrilin; +Cc: netdev, Or Gerlitz

On 09/03/2012 02:51 PM, Yevgeny Petrilin wrote:
>> If you can share, what can we expect it to be like? Like the chunk I suggested
>> above or is there anything else needed? I could notice only 6 places calling
>> get_promisc_qp() that way and couldn't find any other issue like that.
>>
>
> The fix is pretty much the same style like what you suggested.

Awesome. Thanks!
Marcelo

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

* RE: Possible issue with Mellanox mlx4/port handling
  2012-09-03 17:45 ` Marcelo Ricardo Leitner
@ 2012-09-03 17:51   ` Yevgeny Petrilin
  2012-09-03 18:16     ` Marcelo Ricardo Leitner
  0 siblings, 1 reply; 6+ messages in thread
From: Yevgeny Petrilin @ 2012-09-03 17:51 UTC (permalink / raw)
  To: mleitner; +Cc: netdev, Or Gerlitz

> If you can share, what can we expect it to be like? Like the chunk I suggested
> above or is there anything else needed? I could notice only 6 places calling
> get_promisc_qp() that way and couldn't find any other issue like that.
> 

The fix is pretty much the same style like what you suggested.

Yevgeny

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

* Re: Possible issue with Mellanox mlx4/port handling
  2012-09-03 17:32 Yevgeny Petrilin
@ 2012-09-03 17:45 ` Marcelo Ricardo Leitner
  2012-09-03 17:51   ` Yevgeny Petrilin
  0 siblings, 1 reply; 6+ messages in thread
From: Marcelo Ricardo Leitner @ 2012-09-03 17:45 UTC (permalink / raw)
  To: Yevgeny Petrilin; +Cc: netdev, Or Gerlitz

On 09/03/2012 02:32 PM, Yevgeny Petrilin wrote:
>> Commit
>> http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=commitdiff;h=4c41b3673759d096106e68bce586f103c51d4119
>> inserted changes like:
>>
>> @@ -361,7 +361,7 @@ static int add_promisc_qp(struct mlx4_dev *dev, u8
>> port,
>>           int err;
>>           struct mlx4_priv *priv = mlx4_priv(dev);
>>
>> -       s_steer =&mlx4_priv(dev)->steer[0];
>> +       s_steer =&mlx4_priv(dev)->steer[port - 1];
>>
>>           mutex_lock(&priv->mcg_table.mutex);
>>
>> But I fear we missed one part of the deal. Concept patch:
>>
>> @@ -365,7 +365,7 @@ static int add_promisc_qp(struct mlx4_dev *dev, u8
>> port,
>>
>>           mutex_lock(&priv->mcg_table.mutex);
>>
>> -       if (get_promisc_qp(dev, 0, steer, qpn)) {
>> +       if (get_promisc_qp(dev, port - 1, steer, qpn)) {
>>                   err = 0;  /* Noting to do, already exists */
>>                   goto out_mutex;
>>           }
>>
> ...
>>
>> As far as I can understand, we are changing a list for a port and checking for
>> duplicates on the other list. Points marked as A, B and C for highlighting. Am I
>> missing something? What do you think?
>>
>> FWIW, this call get_promisc_qp(dev, 0, ...) happens in other places too.
>>
>> Thank you,
>> Marcelo.
>
> Hi Marcelo,
> Thanks for this, You are absolutely right.
> We actually have a fix for this issue which we are now verifying, and it will be sent to the mailing list in a few days.

Hi Yevgeny,

Thanks for the fast confirmation.

If you can share, what can we expect it to be like? Like the chunk I 
suggested above or is there anything else needed? I could notice only 6 
places calling get_promisc_qp() that way and couldn't find any other 
issue like that.

Thanks,
Marcelo.

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

* RE: Possible issue with Mellanox mlx4/port handling
@ 2012-09-03 17:32 Yevgeny Petrilin
  2012-09-03 17:45 ` Marcelo Ricardo Leitner
  0 siblings, 1 reply; 6+ messages in thread
From: Yevgeny Petrilin @ 2012-09-03 17:32 UTC (permalink / raw)
  To: mleitner; +Cc: netdev, Or Gerlitz

> Commit
> http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=commitdiff;h=4c41b3673759d096106e68bce586f103c51d4119
> inserted changes like:
> 
> @@ -361,7 +361,7 @@ static int add_promisc_qp(struct mlx4_dev *dev, u8
> port,
>          int err;
>          struct mlx4_priv *priv = mlx4_priv(dev);
> 
> -       s_steer = &mlx4_priv(dev)->steer[0];
> +       s_steer = &mlx4_priv(dev)->steer[port - 1];
> 
>          mutex_lock(&priv->mcg_table.mutex);
> 
> But I fear we missed one part of the deal. Concept patch:
> 
> @@ -365,7 +365,7 @@ static int add_promisc_qp(struct mlx4_dev *dev, u8
> port,
> 
>          mutex_lock(&priv->mcg_table.mutex);
> 
> -       if (get_promisc_qp(dev, 0, steer, qpn)) {
> +       if (get_promisc_qp(dev, port - 1, steer, qpn)) {
>                  err = 0;  /* Noting to do, already exists */
>                  goto out_mutex;
>          }
> 
...
> 
> As far as I can understand, we are changing a list for a port and checking for
> duplicates on the other list. Points marked as A, B and C for highlighting. Am I
> missing something? What do you think?
> 
> FWIW, this call get_promisc_qp(dev, 0, ...) happens in other places too.
> 
> Thank you,
> Marcelo.

Hi Marcelo,
Thanks for this, You are absolutely right.
We actually have a fix for this issue which we are now verifying, and it will be sent to the mailing list in a few days.

Thanks,
Yevgeny

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

end of thread, other threads:[~2012-09-03 18:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-31 12:25 Possible issue with Mellanox be2net/port handling Marcelo Ricardo Leitner
2012-08-31 12:26 ` Possible issue with Mellanox mlx4/port handling Marcelo Ricardo Leitner
2012-09-03 17:32 Yevgeny Petrilin
2012-09-03 17:45 ` Marcelo Ricardo Leitner
2012-09-03 17:51   ` Yevgeny Petrilin
2012-09-03 18:16     ` Marcelo Ricardo Leitner

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.