[ofa-general] Re: [RFC/PATCH] mthca: ensure alignment of doorbell writes

Jack Morgenstein jackm at dev.mellanox.co.il
Wed Oct 17 07:58:02 PDT 2007


On Tuesday 16 October 2007 05:20, Roland Dreier wrote:
>  int mthca_arbel_arm_cq(struct ib_cq *ibcq, enum ib_cq_notify_flags flags)
>  {
>         struct mthca_cq *cq = to_mcq(ibcq);
> -       __be32 doorbell[2];
> -       u32 sn;
> -       __be32 ci;
> -
> -       sn = cq->arm_sn & 3;
> -       ci = cpu_to_be32(cq->cons_index);
> +       __be32 db_rec[2];
> +       u32 dbhi;
> +       u32 sn = cq->arm_sn & 3;
>  
> -       doorbell[0] = ci;
> -       doorbell[1] = cpu_to_be32((cq->cqn << 8) | (2 << 5) | (sn << 3) |
> -                                 ((flags & IB_CQ_SOLICITED_MASK) ==
> -                                  IB_CQ_SOLICITED ? 1 : 2));
> +       db_rec[0] = cpu_to_be32(cq->cons_index);
> +       db_rec[1] = cpu_to_be32((cq->cqn << 8) | (2 << 5) | (sn << 3) |
> +                               ((flags & IB_CQ_SOLICITED_MASK) ==
> +                                IB_CQ_SOLICITED ? 1 : 2));
>  
> -       mthca_write_db_rec(doorbell, cq->arm_db);
> +       mthca_write_db_rec(db_rec, cq->arm_db);
>  
Patch looks good, but don't you have the same 64-bit alignment problem in mthca_write_db_rec() ?

- Jack


More information about the general mailing list