netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: ogerlitz@mellanox.com
Cc: netdev@vger.kernel.org, eranbe@mellanox.com, saeedm@mellanox.com
Subject: Re: [PATCH net 2/2] net/mlx5e: Use a private copy of netdev ops
Date: Thu, 28 Jan 2016 20:00:38 -0800 (PST)	[thread overview]
Message-ID: <20160128.200038.1283811216884732396.davem@davemloft.net> (raw)
In-Reply-To: <1453906945-25414-3-git-send-email-ogerlitz@mellanox.com>

From: Or Gerlitz <ogerlitz@mellanox.com>
Date: Wed, 27 Jan 2016 17:02:25 +0200

> From: Saeed Mahameed <saeedm@mellanox.com>
> 
> Currently our netdevice ops is a static global variable which
> is referenced by all mlx5e netdevice instances. This can be
> problematic when different driver instances do not share same
> HW capabilities (e.g SRIOV PF and VFs probed to the host).
> 
> Remove the global variable and add a private net_device_ops
> field in netdevice private data, which is initialized at
> netdev construction.
> 
> Fixes: 66e49dedada6 ("net/mlx5e: Add support for SR-IOV ndos")
> Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
> Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>

This is not the canonical way to fix this.  Please look at how
other drivers handle this situation before inventing your own
way of solving the problem.

The proper way is to have multiple netdevice ops instances, and simply
choose the one which is correct for the chip in question.

You should also mark the ops as const.  They should never _ever_ be
modified at runtime.

  reply	other threads:[~2016-01-29  4:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-27 15:02 [PATCH net 0/2] mlx5 driver fixes for 4.5-rc1 Or Gerlitz
2016-01-27 15:02 ` [PATCH net 1/2] net/mlx5_core: Set flow steering dest only for forward rules Or Gerlitz
2016-01-27 15:02 ` [PATCH net 2/2] net/mlx5e: Use a private copy of netdev ops Or Gerlitz
2016-01-29  4:00   ` David Miller [this message]
2016-01-29 13:17     ` Or Gerlitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160128.200038.1283811216884732396.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=eranbe@mellanox.com \
    --cc=netdev@vger.kernel.org \
    --cc=ogerlitz@mellanox.com \
    --cc=saeedm@mellanox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).