net/mlx5: E-Switch, Re-read device caps after FDB create/destroy
Re-read device capabilities after eswitch tables are created or
destroyed to reflect capability changes that the firmware may apply, e.g
due to tables created with encap flag set. It required for ECPF since it
creates the FDB before the NIC netdevice is initialized. This change
will allow it to read the correct capabilities.
Modify representors states according to the new scheme. With the new
scheme, a representor can be in on of the following states:
- unregistered
- registered
- enabled
- loaded
Now, that we may have a representor for vport 0, we extend the range of
registered vports to include vport 0 and also ecpf for the case where
the eswitch manager is running on the host.
We also change the prototype of mlx5_ib_get_rep_ibdev() and
mlx5_ib_get_rep_netdev() to accept vport number instead of vport index.
This matches mlx5_eswitch_get_proto_dev() which is used to return the
actual pointer to the device.
Lastly, we add sysfs entries to mlx5 IB devices to show the representor
state and the vport this representor is associated with.
With the introduction of ECPF, where the ECPF can be the page supplier
for a PF, we require that the ECPF driver will call enable/disable HCA
for that PF in the same way a PF does this for its VFs. The PF is still
responsible for calling enable/disable HCA for its VFs.
To distinguish between the ECPF executing enable/disable HCA for itself
or for the PF, it sets the embedded_cpu_function bit in the input params
struct of these commands. When the bit is cleared and func_id is zero,
it refers to the peer PF.
net/mlx5: E-Switch, Use indices to index into vport arrays
Since vport number can no longer act as an index into the vport or
representors arrays, use a function to map vport numbers to indices when
accessing the vports or representors arrays.
net/mlx5: E-Switcn, Fix reference to my vport number
Functions referring to vport numbers used to pass 0 as the vport number
argument to denote that they refer to their own vport numbers. So far it
was sufficient but now with ECPF being able to access port 0, this is not
enough anymore. Use real vport number and let the callee encode the
correct values in the command so it refers to the right vport number.
net/mlx5: E-Switch, Modify vport encoding in commands
Commands referring to vports use the following scheme:
1. When referring to my own vport, put 0 in vport and 0 in other_vport.
2. When referring to another vport, put the vport number of the referred
vport and put 1 in other_vport.
Some functions made use of this knowledge when they wanted to access
their own vport by passing 0. This is not good since it does not allow
to distinguish between the case when ECPF wants to access vport 0 and
the case where a function wants to access its own vport.
This get_other_vport() is defined to return the correct setting for the
other_vport fields and modify the vport_num value to correctly encode
the desired vport number.