Message ID | 1398948716-6765-2-git-send-email-ogerlitz@mellanox.com |
---|---|
State | Changes Requested, archived |
Delegated to: | David Miller |
Headers | show |
Hello. On 05/01/2014 04:51 PM, Or Gerlitz wrote: > From: Jack Morgenstein <jackm@dev.mellanox.co.il> > When using single ported VFs and the VF is using port 2, we need > to adjust the port accordingly (change it from 1 to 2). > Fixes: 449fc48 ('net/mlx4: Adapt code for N-Port VF') > Signed-off-by: Matan Barak <matanb@mellanox.com> > Signed-off-by: Jack Morgenstein <jackm@mellanox.com> > Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com> > --- > .../net/ethernet/mellanox/mlx4/resource_tracker.c | 23 ++++++++++++++++++++ > 1 files changed, 23 insertions(+), 0 deletions(-) > diff --git a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c > index 3b5f53e..3f27cba 100644 > --- a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c > +++ b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c > @@ -3733,6 +3733,25 @@ static int qp_detach(struct mlx4_dev *dev, struct mlx4_qp *qp, > } > } > > +static int mlx4_adjust_port(struct mlx4_dev *dev, int slave, > + u8 *gid, enum mlx4_protocol prot) > +{ > + int real_port; > + > + if (prot != MLX4_PROT_ETH) > + return 0; > + > + if (dev->caps.steering_mode == MLX4_STEERING_MODE_B0 || > + (dev->caps.steering_mode == MLX4_STEERING_MODE_DEVICE_MANAGED)) { It looks a bit strange when you enclose in parens the second == but not the first. In fact, they're not at all necessary. WBR, Sergei -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Thu, May 1, 2014 at 10:54 PM, Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> wrote: > On 05/01/2014 04:51 PM, Or Gerlitz wrote: >> +static int mlx4_adjust_port(struct mlx4_dev *dev, int slave, >> + u8 *gid, enum mlx4_protocol prot) >> +{ >> + int real_port; >> + >> + if (prot != MLX4_PROT_ETH) >> + return 0; >> + >> + if (dev->caps.steering_mode == MLX4_STEERING_MODE_B0 || >> + (dev->caps.steering_mode == MLX4_STEERING_MODE_DEVICE_MANAGED)) { > > > It looks a bit strange when you enclose in parens the second == but not the first. In fact, they're not at all necessary. Well... so we'll fix it and resubmit -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c index 3b5f53e..3f27cba 100644 --- a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c +++ b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c @@ -3733,6 +3733,25 @@ static int qp_detach(struct mlx4_dev *dev, struct mlx4_qp *qp, } } +static int mlx4_adjust_port(struct mlx4_dev *dev, int slave, + u8 *gid, enum mlx4_protocol prot) +{ + int real_port; + + if (prot != MLX4_PROT_ETH) + return 0; + + if (dev->caps.steering_mode == MLX4_STEERING_MODE_B0 || + (dev->caps.steering_mode == MLX4_STEERING_MODE_DEVICE_MANAGED)) { + real_port = mlx4_slave_convert_port(dev, slave, gid[5]); + if (real_port < 0) + return -EINVAL; + gid[5] = real_port; + } + + return 0; +} + int mlx4_QP_ATTACH_wrapper(struct mlx4_dev *dev, int slave, struct mlx4_vhcr *vhcr, struct mlx4_cmd_mailbox *inbox, @@ -3768,6 +3787,10 @@ int mlx4_QP_ATTACH_wrapper(struct mlx4_dev *dev, int slave, if (err) goto ex_detach; } else { + err = mlx4_adjust_port(dev, slave, gid, prot); + if (err) + goto ex_put; + err = rem_mcg_res(dev, slave, rqp, gid, prot, type, ®_id); if (err) goto ex_put;