aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOr Gerlitz <ogerlitz@mellanox.com>2015-05-21 08:14:05 -0400
committerDavid S. Miller <davem@davemloft.net>2015-05-24 23:05:09 -0400
commit7c35ef4525c3255c747b935fe5af9ef4d1fbbf93 (patch)
tree13ec1be83797748261b060c348b0b9f6fc7ecd56
parent29044b58869b60b18071154446d39e83f31d9b67 (diff)
net/mlx4_core: Enhance the MAD_IFC wrapper to convert VF port to physical
Single port VFs always provide port = 1 (even if the actual physical port used is port 2). As such, we need to convert the port provided by the VF to the physical port before calling into the firmware. It turns out that the Linux mlx4 VF RoCE driver maintains a copy of the GID table and hence this change became critical only for single ported IB VFs, but it could be needed for other RoCE VF drivers too. Fixes: 449fc48866f7 ('net/mlx4: Adapt code for N-Port VF') Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com> Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/cmd.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx4/cmd.c b/drivers/net/ethernet/mellanox/mlx4/cmd.c
index 4f7dc044601e..153fb15769a8 100644
--- a/drivers/net/ethernet/mellanox/mlx4/cmd.c
+++ b/drivers/net/ethernet/mellanox/mlx4/cmd.c
@@ -877,7 +877,7 @@ static int mlx4_MAD_IFC_wrapper(struct mlx4_dev *dev, int slave,
877{ 877{
878 struct ib_smp *smp = inbox->buf; 878 struct ib_smp *smp = inbox->buf;
879 u32 index; 879 u32 index;
880 u8 port; 880 u8 port, slave_port;
881 u8 opcode_modifier; 881 u8 opcode_modifier;
882 u16 *table; 882 u16 *table;
883 int err; 883 int err;
@@ -889,7 +889,8 @@ static int mlx4_MAD_IFC_wrapper(struct mlx4_dev *dev, int slave,
889 __be32 slave_cap_mask; 889 __be32 slave_cap_mask;
890 __be64 slave_node_guid; 890 __be64 slave_node_guid;
891 891
892 port = vhcr->in_modifier; 892 slave_port = vhcr->in_modifier;
893 port = mlx4_slave_convert_port(dev, slave, slave_port);
893 894
894 /* network-view bit is for driver use only, and should not be passed to FW */ 895 /* network-view bit is for driver use only, and should not be passed to FW */
895 opcode_modifier = vhcr->op_modifier & ~0x8; /* clear netw view bit */ 896 opcode_modifier = vhcr->op_modifier & ~0x8; /* clear netw view bit */
@@ -925,8 +926,9 @@ static int mlx4_MAD_IFC_wrapper(struct mlx4_dev *dev, int slave,
925 if (smp->attr_id == IB_SMP_ATTR_PORT_INFO) { 926 if (smp->attr_id == IB_SMP_ATTR_PORT_INFO) {
926 /*get the slave specific caps:*/ 927 /*get the slave specific caps:*/
927 /*do the command */ 928 /*do the command */
929 smp->attr_mod = cpu_to_be32(port);
928 err = mlx4_cmd_box(dev, inbox->dma, outbox->dma, 930 err = mlx4_cmd_box(dev, inbox->dma, outbox->dma,
929 vhcr->in_modifier, opcode_modifier, 931 port, opcode_modifier,
930 vhcr->op, MLX4_CMD_TIME_CLASS_C, MLX4_CMD_NATIVE); 932 vhcr->op, MLX4_CMD_TIME_CLASS_C, MLX4_CMD_NATIVE);
931 /* modify the response for slaves */ 933 /* modify the response for slaves */
932 if (!err && slave != mlx4_master_func_num(dev)) { 934 if (!err && slave != mlx4_master_func_num(dev)) {
@@ -970,7 +972,7 @@ static int mlx4_MAD_IFC_wrapper(struct mlx4_dev *dev, int slave,
970 } 972 }
971 if (smp->attr_id == IB_SMP_ATTR_NODE_INFO) { 973 if (smp->attr_id == IB_SMP_ATTR_NODE_INFO) {
972 err = mlx4_cmd_box(dev, inbox->dma, outbox->dma, 974 err = mlx4_cmd_box(dev, inbox->dma, outbox->dma,
973 vhcr->in_modifier, opcode_modifier, 975 port, opcode_modifier,
974 vhcr->op, MLX4_CMD_TIME_CLASS_C, MLX4_CMD_NATIVE); 976 vhcr->op, MLX4_CMD_TIME_CLASS_C, MLX4_CMD_NATIVE);
975 if (!err) { 977 if (!err) {
976 slave_node_guid = mlx4_get_slave_node_guid(dev, slave); 978 slave_node_guid = mlx4_get_slave_node_guid(dev, slave);