net/mlx5: E-switch, Use PF num in metadata reg c0
Currently only 256 vports can be supported as only 8 bits are reserved for them and 8 bits are reserved for vhca_ids in metadata reg c0. To support more than 256 vports, replace vhca_id with a unique shorter 4-bit PF number which covers upto 16 PF's. Use remaining 12 bits for vports ranging 1-4095. This will continue to generate unique metadata even if multiple PCI devices have same switch_id. Signed-off-by: sunils <sunils@nvidia.com> Reviewed-by: Parav Pandit <parav@nvidia.com> Reviewed-by: Vu Pham <vuhuong@nvidia.com> Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
This commit is contained in:
parent
0172391967
commit
7cd7becddd
2 changed files with 26 additions and 25 deletions
|
|
@ -74,15 +74,16 @@ bool mlx5_eswitch_reg_c1_loopback_enabled(const struct mlx5_eswitch *esw);
|
|||
bool mlx5_eswitch_vport_match_metadata_enabled(const struct mlx5_eswitch *esw);
|
||||
|
||||
/* Reg C0 usage:
|
||||
* Reg C0 = < ESW_VHCA_ID_BITS(8) | ESW_VPORT BITS(8) | ESW_CHAIN_TAG(16) >
|
||||
* Reg C0 = < ESW_PFNUM_BITS(4) | ESW_VPORT BITS(12) | ESW_CHAIN_TAG(16) >
|
||||
*
|
||||
* Highest 8 bits of the reg c0 is the vhca_id, next 8 bits is vport_num,
|
||||
* the rest (lowest 16 bits) is left for tc chain tag restoration.
|
||||
* VHCA_ID + VPORT comprise the SOURCE_PORT matching.
|
||||
* Highest 4 bits of the reg c0 is the PF_NUM (range 0-15), 12 bits of
|
||||
* unique non-zero vport id (range 1-4095). The rest (lowest 16 bits) is left
|
||||
* for tc chain tag restoration.
|
||||
* PFNUM + VPORT comprise the SOURCE_PORT matching.
|
||||
*/
|
||||
#define ESW_VHCA_ID_BITS 8
|
||||
#define ESW_VPORT_BITS 8
|
||||
#define ESW_SOURCE_PORT_METADATA_BITS (ESW_VHCA_ID_BITS + ESW_VPORT_BITS)
|
||||
#define ESW_VPORT_BITS 12
|
||||
#define ESW_PFNUM_BITS 4
|
||||
#define ESW_SOURCE_PORT_METADATA_BITS (ESW_PFNUM_BITS + ESW_VPORT_BITS)
|
||||
#define ESW_SOURCE_PORT_METADATA_OFFSET (32 - ESW_SOURCE_PORT_METADATA_BITS)
|
||||
#define ESW_CHAIN_TAG_METADATA_BITS (32 - ESW_SOURCE_PORT_METADATA_BITS)
|
||||
#define ESW_CHAIN_TAG_METADATA_MASK GENMASK(ESW_CHAIN_TAG_METADATA_BITS - 1,\
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue