[ofa-general] [PATCH] for-2.6.23 ib/umad: add partition support

Hal Rosenstock halr at voltaire.com
Wed Jun 20 14:18:38 PDT 2007


On Fri, 2007-06-15 at 12:34, Sean Hefty wrote:
> In order to support multiple partitions, user_mad needs to handle
> 
> different pkey's.  PKeys must be specified by the user when sending
> 
> and receiving MADs.  This bumps the ABI.
> 
> Signed-off-by: Sean Hefty <sean.hefty at intel.com>
> 
> ---
> 
> If there are no objections, I will queue this patch for 2.6.23, and
> request
> 
> a pull when 2.6.23 is closer.
> 
> 
>  drivers/infiniband/core/user_mad.c |    5 +++--
> 
>  include/rdma/ib_user_mad.h         |    4 +++-
> 
>  2 files changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/infiniband/core/user_mad.c
> b/drivers/infiniband/core/user_mad.c
> 
> index d97ded2..b0128fa 100644
> 
> --- a/drivers/infiniband/core/user_mad.c
> 
> +++ b/drivers/infiniband/core/user_mad.c
> 
> @@ -228,6 +228,7 @@ static void recv_handler(struct ib_mad_agent
> *agent,
> 
>         packet->mad.hdr.lid       =
> cpu_to_be16(mad_recv_wc->wc->slid);
> 
>         packet->mad.hdr.sl        = mad_recv_wc->wc->sl;
> 
>         packet->mad.hdr.path_bits = mad_recv_wc->wc->dlid_path_bits;
> 
> +       packet->mad.hdr.pkey_index  = mad_recv_wc->wc->pkey_index;
> 
>         packet->mad.hdr.grh_present = !!(mad_recv_wc->wc->wc_flags &
> IB_WC_GRH);
> 
>         if (packet->mad.hdr.grh_present) {
> 
>                 struct ib_ah_attr ah_attr;
> 
> @@ -503,8 +504,8 @@ static ssize_t ib_umad_write(struct file *filp,
> const char __user *buf,
> 
>         data_len = count - sizeof (struct ib_user_mad) - hdr_len;
> 
>         packet->msg = ib_create_send_mad(agent,
> 
>                                         
> be32_to_cpu(packet->mad.hdr.qpn),
> 
> -                                        0, rmpp_active, hdr_len,
> 
> -                                        data_len, GFP_KERNEL);
> 
> +                                        packet->mad.hdr.pkey_index,
> rmpp_active,
> 
> +                                        hdr_len, data_len,
> GFP_KERNEL);
> 
>         if (IS_ERR(packet->msg)) {
> 
>                 ret = PTR_ERR(packet->msg);
> 
>                 goto err_ah;
> 
> diff --git a/include/rdma/ib_user_mad.h b/include/rdma/ib_user_mad.h
> 
> index d66b15e..e7bf6fa 100644
> 
> --- a/include/rdma/ib_user_mad.h
> 
> +++ b/include/rdma/ib_user_mad.h
> 
> @@ -43,7 +43,7 @@
> 
>   * Increment this value if any changes that break userspace ABI
> 
>   * compatibility are made.
> 
>   */
> 
> -#define IB_USER_MAD_ABI_VERSION        5
> 
> +#define IB_USER_MAD_ABI_VERSION        6
> 
>  
> 
>  /*
> 
>   * Make sure that all structs defined in this file remain laid out so
> 
> @@ -88,6 +88,8 @@ struct ib_user_mad_hdr {
> 
>         __u8    traffic_class;
> 
>         __u8    gid[16];
> 
>         __be32  flow_label;
> 
> +       __u16   pkey_index;
> 
> +       __u8    reserved[6];
> 
>  };

Nit: If this approach is going ahead, should there also be a comment
added to this header file like:

 * @pkey_index - Pkey index used to determine PKey in BTH

-- Hal

>  /**
> 
> 




More information about the general mailing list