Re: [PATCH net 2/2] net/mlx5e: Use a private copy of netdev ops
From: David Miller <davem@davemloft.net>
Date: 2016-01-29 04:00:42
From: David Miller <davem@davemloft.net>
Date: 2016-01-29 04:00:42
From: Or Gerlitz <redacted> Date: Wed, 27 Jan 2016 17:02:25 +0200
From: Saeed Mahameed <redacted>
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 <redacted>
Signed-off-by: Or Gerlitz <redacted>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.