Re: [PATCH rdma-next 09/31] IB/core: Make sure that PSN does not overflow

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Nov 14, 2017 at 2:51 PM, Leon Romanovsky <leon@xxxxxxxxxx> wrote:
> From: Majd Dibbiny <majd@xxxxxxxxxxxx>
>
> The rq/sq->psn is 24 bits as defined in the IB spec,therefore we mask
> out the 8 most significant bits to avoid overflow in modify qp.
>
> Signed-off-by: Majd Dibbiny <majd@xxxxxxxxxxxx>
> Signed-off-by: Daniel Jurgens <danielj@xxxxxxxxxxxx>
> Reviewed-by: Parav Pandit <parav@xxxxxxxxxxxx>
> Signed-off-by: Leon Romanovsky <leon@xxxxxxxxxx>
> ---
>  drivers/infiniband/core/verbs.c | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
>
> diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c
> index 75ebd74f8bbd..584b6029cb44 100644
> --- a/drivers/infiniband/core/verbs.c
> +++ b/drivers/infiniband/core/verbs.c
> @@ -1321,6 +1321,7 @@ static int ib_resolve_eth_dmac(struct ib_device *device,
>  int ib_modify_qp_with_udata(struct ib_qp *qp, struct ib_qp_attr *attr,
>                             int attr_mask, struct ib_udata *udata)
>  {
> +       u8 port = attr_mask & IB_QP_PORT ? attr->port_num : qp->port;
>         int ret;
>
>         if (attr_mask & IB_QP_AV) {
> @@ -1328,6 +1329,21 @@ int ib_modify_qp_with_udata(struct ib_qp *qp, struct ib_qp_attr *attr,
>                 if (ret)
>                         return ret;
>         }
> +
> +       if (rdma_ib_or_roce(qp->device, port)) {
> +               if (attr_mask & IB_QP_RQ_PSN && attr->rq_psn & ~0xffffff) {
> +                       pr_warn("%s: %s rq_psn overflow, masking to 24 bits\n",
> +                               __func__, qp->device->name);
> +                       attr->rq_psn &= 0xffffff;
> +               }
> +
> +               if (attr_mask & IB_QP_SQ_PSN && attr->sq_psn & ~0xffffff) {
> +                       pr_warn("%s: %s sq_psn overflow, masking to 24 bits\n",
> +                               __func__, qp->device->name);
> +                       attr->sq_psn &= 0xffffff;
> +               }
> +       }
> +

Isn't this what we tried to push in the past and Jason/Sean rejected [1]?

[1] https://marc.info/?l=linux-rdma&m=142309249413868&w=2


>         ret = ib_security_modify_qp(qp, attr, attr_mask, udata);
>         if (!ret && (attr_mask & IB_QP_PORT))
>                 qp->port = attr->port_num;
> --
> 2.15.0
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux