diff options
author | Ido Shamay <idos@mellanox.com> | 2015-04-02 09:31:19 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-04-02 16:25:03 -0400 |
commit | a130b59057320192b4b00ed0ba4bc8a38f66f289 (patch) | |
tree | c2617fd4f1849e95744fac88cb9eea900cf2590d | |
parent | 38438f7c7e8cdbb0e9f55aae0e43da67c460639f (diff) |
net/mlx4: Add SET_PORT opcode modifiers enumeration
The calls to SET_PORT used hard-code numbers, when supplying command's
opcode modifiers, fix that to use well defined constants.
Signed-off-by: Ido Shamay <idos@mellanox.com>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/infiniband/hw/mlx4/main.c | 11 | ||||
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/cmd.c | 3 | ||||
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/port.c | 36 | ||||
-rw-r--r-- | include/linux/mlx4/cmd.h | 8 |
4 files changed, 36 insertions, 22 deletions
diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c index b972c0b41799..976bea794b5f 100644 --- a/drivers/infiniband/hw/mlx4/main.c +++ b/drivers/infiniband/hw/mlx4/main.c | |||
@@ -587,8 +587,9 @@ static int mlx4_ib_SET_PORT(struct mlx4_ib_dev *dev, u8 port, int reset_qkey_vio | |||
587 | ((__be32 *) mailbox->buf)[1] = cpu_to_be32(cap_mask); | 587 | ((__be32 *) mailbox->buf)[1] = cpu_to_be32(cap_mask); |
588 | } | 588 | } |
589 | 589 | ||
590 | err = mlx4_cmd(dev->dev, mailbox->dma, port, 0, MLX4_CMD_SET_PORT, | 590 | err = mlx4_cmd(dev->dev, mailbox->dma, port, MLX4_SET_PORT_IB_OPCODE, |
591 | MLX4_CMD_TIME_CLASS_B, MLX4_CMD_WRAPPED); | 591 | MLX4_CMD_SET_PORT, MLX4_CMD_TIME_CLASS_B, |
592 | MLX4_CMD_WRAPPED); | ||
592 | 593 | ||
593 | mlx4_free_cmd_mailbox(dev->dev, mailbox); | 594 | mlx4_free_cmd_mailbox(dev->dev, mailbox); |
594 | return err; | 595 | return err; |
@@ -1525,8 +1526,8 @@ static void update_gids_task(struct work_struct *work) | |||
1525 | memcpy(gids, gw->gids, sizeof gw->gids); | 1526 | memcpy(gids, gw->gids, sizeof gw->gids); |
1526 | 1527 | ||
1527 | err = mlx4_cmd(dev, mailbox->dma, MLX4_SET_PORT_GID_TABLE << 8 | gw->port, | 1528 | err = mlx4_cmd(dev, mailbox->dma, MLX4_SET_PORT_GID_TABLE << 8 | gw->port, |
1528 | 1, MLX4_CMD_SET_PORT, MLX4_CMD_TIME_CLASS_B, | 1529 | MLX4_SET_PORT_ETH_OPCODE, MLX4_CMD_SET_PORT, |
1529 | MLX4_CMD_WRAPPED); | 1530 | MLX4_CMD_TIME_CLASS_B, MLX4_CMD_WRAPPED); |
1530 | if (err) | 1531 | if (err) |
1531 | pr_warn("set port command failed\n"); | 1532 | pr_warn("set port command failed\n"); |
1532 | else | 1533 | else |
@@ -1564,7 +1565,7 @@ static void reset_gids_task(struct work_struct *work) | |||
1564 | IB_LINK_LAYER_ETHERNET) { | 1565 | IB_LINK_LAYER_ETHERNET) { |
1565 | err = mlx4_cmd(dev, mailbox->dma, | 1566 | err = mlx4_cmd(dev, mailbox->dma, |
1566 | MLX4_SET_PORT_GID_TABLE << 8 | gw->port, | 1567 | MLX4_SET_PORT_GID_TABLE << 8 | gw->port, |
1567 | 1, MLX4_CMD_SET_PORT, | 1568 | MLX4_SET_PORT_ETH_OPCODE, MLX4_CMD_SET_PORT, |
1568 | MLX4_CMD_TIME_CLASS_B, | 1569 | MLX4_CMD_TIME_CLASS_B, |
1569 | MLX4_CMD_WRAPPED); | 1570 | MLX4_CMD_WRAPPED); |
1570 | if (err) | 1571 | if (err) |
diff --git a/drivers/net/ethernet/mellanox/mlx4/cmd.c b/drivers/net/ethernet/mellanox/mlx4/cmd.c index bc6e4c9b6bb5..06993ea9e6ba 100644 --- a/drivers/net/ethernet/mellanox/mlx4/cmd.c +++ b/drivers/net/ethernet/mellanox/mlx4/cmd.c | |||
@@ -726,7 +726,8 @@ static int mlx4_cmd_wait(struct mlx4_dev *dev, u64 in_param, u64 *out_param, | |||
726 | * specific command/input_mod/opcode_mod/fw-status to be debug. | 726 | * specific command/input_mod/opcode_mod/fw-status to be debug. |
727 | */ | 727 | */ |
728 | if (op == MLX4_CMD_SET_PORT && in_modifier == 1 && | 728 | if (op == MLX4_CMD_SET_PORT && in_modifier == 1 && |
729 | op_modifier == 0 && context->fw_status == CMD_STAT_BAD_SIZE) | 729 | op_modifier == MLX4_SET_PORT_IB_OPCODE && |
730 | context->fw_status == CMD_STAT_BAD_SIZE) | ||
730 | mlx4_dbg(dev, "command 0x%x failed: fw status = 0x%x\n", | 731 | mlx4_dbg(dev, "command 0x%x failed: fw status = 0x%x\n", |
731 | op, context->fw_status); | 732 | op, context->fw_status); |
732 | else | 733 | else |
diff --git a/drivers/net/ethernet/mellanox/mlx4/port.c b/drivers/net/ethernet/mellanox/mlx4/port.c index 6a53d42db52f..ca4488ed561c 100644 --- a/drivers/net/ethernet/mellanox/mlx4/port.c +++ b/drivers/net/ethernet/mellanox/mlx4/port.c | |||
@@ -123,8 +123,9 @@ static int mlx4_set_port_mac_table(struct mlx4_dev *dev, u8 port, | |||
123 | 123 | ||
124 | in_mod = MLX4_SET_PORT_MAC_TABLE << 8 | port; | 124 | in_mod = MLX4_SET_PORT_MAC_TABLE << 8 | port; |
125 | 125 | ||
126 | err = mlx4_cmd(dev, mailbox->dma, in_mod, 1, MLX4_CMD_SET_PORT, | 126 | err = mlx4_cmd(dev, mailbox->dma, in_mod, MLX4_SET_PORT_ETH_OPCODE, |
127 | MLX4_CMD_TIME_CLASS_B, MLX4_CMD_NATIVE); | 127 | MLX4_CMD_SET_PORT, MLX4_CMD_TIME_CLASS_B, |
128 | MLX4_CMD_NATIVE); | ||
128 | 129 | ||
129 | mlx4_free_cmd_mailbox(dev, mailbox); | 130 | mlx4_free_cmd_mailbox(dev, mailbox); |
130 | return err; | 131 | return err; |
@@ -337,8 +338,9 @@ static int mlx4_set_port_vlan_table(struct mlx4_dev *dev, u8 port, | |||
337 | 338 | ||
338 | memcpy(mailbox->buf, entries, MLX4_VLAN_TABLE_SIZE); | 339 | memcpy(mailbox->buf, entries, MLX4_VLAN_TABLE_SIZE); |
339 | in_mod = MLX4_SET_PORT_VLAN_TABLE << 8 | port; | 340 | in_mod = MLX4_SET_PORT_VLAN_TABLE << 8 | port; |
340 | err = mlx4_cmd(dev, mailbox->dma, in_mod, 1, MLX4_CMD_SET_PORT, | 341 | err = mlx4_cmd(dev, mailbox->dma, in_mod, MLX4_SET_PORT_ETH_OPCODE, |
341 | MLX4_CMD_TIME_CLASS_B, MLX4_CMD_NATIVE); | 342 | MLX4_CMD_SET_PORT, MLX4_CMD_TIME_CLASS_B, |
343 | MLX4_CMD_NATIVE); | ||
342 | 344 | ||
343 | mlx4_free_cmd_mailbox(dev, mailbox); | 345 | mlx4_free_cmd_mailbox(dev, mailbox); |
344 | 346 | ||
@@ -625,9 +627,9 @@ static int mlx4_reset_roce_port_gids(struct mlx4_dev *dev, int slave, | |||
625 | MLX4_ROCE_GID_ENTRY_SIZE); | 627 | MLX4_ROCE_GID_ENTRY_SIZE); |
626 | 628 | ||
627 | err = mlx4_cmd(dev, mailbox->dma, | 629 | err = mlx4_cmd(dev, mailbox->dma, |
628 | ((u32)port) | (MLX4_SET_PORT_GID_TABLE << 8), 1, | 630 | ((u32)port) | (MLX4_SET_PORT_GID_TABLE << 8), |
629 | MLX4_CMD_SET_PORT, MLX4_CMD_TIME_CLASS_B, | 631 | MLX4_SET_PORT_ETH_OPCODE, MLX4_CMD_SET_PORT, |
630 | MLX4_CMD_NATIVE); | 632 | MLX4_CMD_TIME_CLASS_B, MLX4_CMD_NATIVE); |
631 | mutex_unlock(&(priv->port[port].gid_table.mutex)); | 633 | mutex_unlock(&(priv->port[port].gid_table.mutex)); |
632 | return err; | 634 | return err; |
633 | } | 635 | } |
@@ -941,8 +943,9 @@ int mlx4_SET_PORT(struct mlx4_dev *dev, u8 port, int pkey_tbl_sz) | |||
941 | (pkey_tbl_flag << MLX4_CHANGE_PORT_PKEY_TBL_SZ) | | 943 | (pkey_tbl_flag << MLX4_CHANGE_PORT_PKEY_TBL_SZ) | |
942 | (dev->caps.port_ib_mtu[port] << MLX4_SET_PORT_MTU_CAP) | | 944 | (dev->caps.port_ib_mtu[port] << MLX4_SET_PORT_MTU_CAP) | |
943 | (vl_cap << MLX4_SET_PORT_VL_CAP)); | 945 | (vl_cap << MLX4_SET_PORT_VL_CAP)); |
944 | err = mlx4_cmd(dev, mailbox->dma, port, 0, MLX4_CMD_SET_PORT, | 946 | err = mlx4_cmd(dev, mailbox->dma, port, |
945 | MLX4_CMD_TIME_CLASS_B, MLX4_CMD_WRAPPED); | 947 | MLX4_SET_PORT_IB_OPCODE, MLX4_CMD_SET_PORT, |
948 | MLX4_CMD_TIME_CLASS_B, MLX4_CMD_WRAPPED); | ||
946 | if (err != -ENOMEM) | 949 | if (err != -ENOMEM) |
947 | break; | 950 | break; |
948 | } | 951 | } |
@@ -971,8 +974,9 @@ int mlx4_SET_PORT_general(struct mlx4_dev *dev, u8 port, int mtu, | |||
971 | context->pfcrx = pfcrx; | 974 | context->pfcrx = pfcrx; |
972 | 975 | ||
973 | in_mod = MLX4_SET_PORT_GENERAL << 8 | port; | 976 | in_mod = MLX4_SET_PORT_GENERAL << 8 | port; |
974 | err = mlx4_cmd(dev, mailbox->dma, in_mod, 1, MLX4_CMD_SET_PORT, | 977 | err = mlx4_cmd(dev, mailbox->dma, in_mod, MLX4_SET_PORT_ETH_OPCODE, |
975 | MLX4_CMD_TIME_CLASS_B, MLX4_CMD_WRAPPED); | 978 | MLX4_CMD_SET_PORT, MLX4_CMD_TIME_CLASS_B, |
979 | MLX4_CMD_WRAPPED); | ||
976 | 980 | ||
977 | mlx4_free_cmd_mailbox(dev, mailbox); | 981 | mlx4_free_cmd_mailbox(dev, mailbox); |
978 | return err; | 982 | return err; |
@@ -1008,8 +1012,9 @@ int mlx4_SET_PORT_qpn_calc(struct mlx4_dev *dev, u8 port, u32 base_qpn, | |||
1008 | context->vlan_miss = MLX4_VLAN_MISS_IDX; | 1012 | context->vlan_miss = MLX4_VLAN_MISS_IDX; |
1009 | 1013 | ||
1010 | in_mod = MLX4_SET_PORT_RQP_CALC << 8 | port; | 1014 | in_mod = MLX4_SET_PORT_RQP_CALC << 8 | port; |
1011 | err = mlx4_cmd(dev, mailbox->dma, in_mod, 1, MLX4_CMD_SET_PORT, | 1015 | err = mlx4_cmd(dev, mailbox->dma, in_mod, MLX4_SET_PORT_ETH_OPCODE, |
1012 | MLX4_CMD_TIME_CLASS_B, MLX4_CMD_WRAPPED); | 1016 | MLX4_CMD_SET_PORT, MLX4_CMD_TIME_CLASS_B, |
1017 | MLX4_CMD_WRAPPED); | ||
1013 | 1018 | ||
1014 | mlx4_free_cmd_mailbox(dev, mailbox); | 1019 | mlx4_free_cmd_mailbox(dev, mailbox); |
1015 | return err; | 1020 | return err; |
@@ -1050,8 +1055,9 @@ int mlx4_SET_PORT_VXLAN(struct mlx4_dev *dev, u8 port, u8 steering, int enable) | |||
1050 | context->steering = steering; | 1055 | context->steering = steering; |
1051 | 1056 | ||
1052 | in_mod = MLX4_SET_PORT_VXLAN << 8 | port; | 1057 | in_mod = MLX4_SET_PORT_VXLAN << 8 | port; |
1053 | err = mlx4_cmd(dev, mailbox->dma, in_mod, 1, MLX4_CMD_SET_PORT, | 1058 | err = mlx4_cmd(dev, mailbox->dma, in_mod, MLX4_SET_PORT_ETH_OPCODE, |
1054 | MLX4_CMD_TIME_CLASS_B, MLX4_CMD_NATIVE); | 1059 | MLX4_CMD_SET_PORT, MLX4_CMD_TIME_CLASS_B, |
1060 | MLX4_CMD_NATIVE); | ||
1055 | 1061 | ||
1056 | mlx4_free_cmd_mailbox(dev, mailbox); | 1062 | mlx4_free_cmd_mailbox(dev, mailbox); |
1057 | return err; | 1063 | return err; |
diff --git a/include/linux/mlx4/cmd.h b/include/linux/mlx4/cmd.h index a788839f54bb..62c4d4def474 100644 --- a/include/linux/mlx4/cmd.h +++ b/include/linux/mlx4/cmd.h | |||
@@ -188,7 +188,13 @@ enum { | |||
188 | }; | 188 | }; |
189 | 189 | ||
190 | enum { | 190 | enum { |
191 | /* set port opcode modifiers */ | 191 | /* Set port opcode modifiers */ |
192 | MLX4_SET_PORT_IB_OPCODE = 0x0, | ||
193 | MLX4_SET_PORT_ETH_OPCODE = 0x1, | ||
194 | }; | ||
195 | |||
196 | enum { | ||
197 | /* Set port Ethernet input modifiers */ | ||
192 | MLX4_SET_PORT_GENERAL = 0x0, | 198 | MLX4_SET_PORT_GENERAL = 0x0, |
193 | MLX4_SET_PORT_RQP_CALC = 0x1, | 199 | MLX4_SET_PORT_RQP_CALC = 0x1, |
194 | MLX4_SET_PORT_MAC_TABLE = 0x2, | 200 | MLX4_SET_PORT_MAC_TABLE = 0x2, |