Skip to content

Commit f38a231

Browse files
jpirkodavem330
authored andcommitted
mlxsw: cmd: Push resource query defines to cmd.h
Push cmd resource query related defines to cmd.h where they belong. Signed-off-by: Jiri Pirko <[email protected]> Reviewed-by: Ido Schimmel <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 8e9658d commit f38a231

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

drivers/net/ethernet/mellanox/mlxsw/cmd.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -513,6 +513,11 @@ static inline int mlxsw_cmd_unmap_fa(struct mlxsw_core *mlxsw_core)
513513
* are no more sources in the table, will return resource id 0xFFF to indicate
514514
* it.
515515
*/
516+
517+
#define MLXSW_CMD_QUERY_RESOURCES_TABLE_END_ID 0xffff
518+
#define MLXSW_CMD_QUERY_RESOURCES_MAX_QUERIES 100
519+
#define MLXSW_CMD_QUERY_RESOURCES_PER_QUERY 32
520+
516521
static inline int mlxsw_cmd_query_resources(struct mlxsw_core *mlxsw_core,
517522
char *out_mbox, int index)
518523
{

drivers/net/ethernet/mellanox/mlxsw/pci.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1155,7 +1155,6 @@ mlxsw_pci_config_profile_swid_config(struct mlxsw_pci *mlxsw_pci,
11551155
mlxsw_cmd_mbox_config_profile_swid_config_mask_set(mbox, index, mask);
11561156
}
11571157

1158-
#define MLXSW_RESOURCES_TABLE_END_ID 0xffff
11591158
#define MLXSW_MAX_SPAN_ID 0x2420
11601159
#define MLXSW_MAX_LAG_ID 0x2520
11611160
#define MLXSW_MAX_PORTS_IN_LAG_ID 0x2521
@@ -1167,8 +1166,6 @@ mlxsw_pci_config_profile_swid_config(struct mlxsw_pci *mlxsw_pci,
11671166
#define MLXSW_MAX_VLAN_GROUPS_ID 0x2906
11681167
#define MLXSW_MAX_REGIONS_ID 0x2901
11691168
#define MLXSW_MAX_RIF_ID 0x2C02
1170-
#define MLXSW_RESOURCES_QUERY_MAX_QUERIES 100
1171-
#define MLXSW_RESOURCES_PER_QUERY 32
11721169

11731170
static void mlxsw_pci_resources_query_parse(int id, u64 val,
11741171
struct mlxsw_resources *resources)
@@ -1238,16 +1235,17 @@ static int mlxsw_pci_resources_query(struct mlxsw_pci *mlxsw_pci, char *mbox,
12381235

12391236
mlxsw_cmd_mbox_zero(mbox);
12401237

1241-
for (index = 0; index < MLXSW_RESOURCES_QUERY_MAX_QUERIES; index++) {
1238+
for (index = 0; index < MLXSW_CMD_QUERY_RESOURCES_MAX_QUERIES;
1239+
index++) {
12421240
err = mlxsw_cmd_query_resources(mlxsw_pci->core, mbox, index);
12431241
if (err)
12441242
return err;
12451243

1246-
for (i = 0; i < MLXSW_RESOURCES_PER_QUERY; i++) {
1244+
for (i = 0; i < MLXSW_CMD_QUERY_RESOURCES_PER_QUERY; i++) {
12471245
id = mlxsw_cmd_mbox_query_resource_id_get(mbox, i);
12481246
data = mlxsw_cmd_mbox_query_resource_data_get(mbox, i);
12491247

1250-
if (id == MLXSW_RESOURCES_TABLE_END_ID)
1248+
if (id == MLXSW_CMD_QUERY_RESOURCES_TABLE_END_ID)
12511249
return 0;
12521250

12531251
mlxsw_pci_resources_query_parse(id, data, resources);

0 commit comments

Comments
 (0)