[openib-general] [PATCH] user_mad: Support RMPP on send side
user_mad: Support RMPP on send side Note that this change will need a coordinated change to OpenSM and some userspace/management libraries which will be done as soon as possible once this patch is accepted. Receive side support for RMPP will be added separately. Signed-off-by: Hal Rosenstock <[EMAIL PROTECTED]> Index: infiniband/include/ib_user_mad.h === --- infiniband/include/ib_user_mad.h(revision 2413) +++ infiniband/include/ib_user_mad.h(working copy) @@ -1,5 +1,6 @@ /* * Copyright (c) 2004 Topspin Communications. All rights reserved. + * Copyright (c) 2005 Voltaire, Inc. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU @@ -42,7 +43,7 @@ * Increment this value if any changes that break userspace ABI * compatibility are made. */ -#define IB_USER_MAD_ABI_VERSION2 +#define IB_USER_MAD_ABI_VERSION3 /* * Make sure that all structs defined in this file remain laid out so @@ -51,8 +52,7 @@ */ /** - * ib_user_mad - MAD packet - * @data - Contents of MAD + * ib_user_mad_hdr - MAD packet header * @id - ID of agent MAD received with/to be sent with * @status - 0 on successful receive, ETIMEDOUT if no response * received (transaction ID in data[] will be set to TID of original @@ -72,8 +72,7 @@ * * All multi-byte quantities are stored in network (big endian) byte order. */ -struct ib_user_mad { - __u8data[256]; +struct ib_user_mad_hdr { __u32 id; __u32 status; __u32 timeout_ms; @@ -91,6 +90,17 @@ }; /** + * ib_user_mad - MAD packet + * @hdr - MAD packet header + * @data - Contents of MAD + * + */ +struct ib_user_mad { + struct ib_user_mad_hdr hdr; + __u8data[0]; +}; + +/** * ib_user_mad_reg_req - MAD registration request * @id - Set by the kernel; used to identify agent in future requests. * @qpn - Queue pair number; must be 0 or 1. @@ -103,6 +113,8 @@ * management class to receive. * @oui: Indicates IEEE OUI when mgmt_class is a vendor class * in the range from 0x30 to 0x4f. Otherwise not used. + * @rmpp_version: If set, indicates the RMPP version used. + * */ struct ib_user_mad_reg_req { __u32 id; @@ -111,6 +123,7 @@ __u8mgmt_class; __u8mgmt_class_version; __u8oui[3]; + __u8rmpp_version; }; #define IB_IOCTL_MAGIC 0x1b Index: infiniband/core/user_mad.c === --- infiniband/core/user_mad.c (revision 2413) +++ infiniband/core/user_mad.c (working copy) @@ -1,5 +1,6 @@ /* * Copyright (c) 2004 Topspin Communications. All rights reserved. + * Copyright (c) 2005 Voltaire, Inc. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU @@ -94,10 +95,12 @@ }; struct ib_umad_packet { - struct ib_user_mad mad; struct ib_ah *ah; + struct ib_mad_send_buf *msg; struct list_head list; + intlength; DECLARE_PCI_UNMAP_ADDR(mapping) + struct ib_user_mad mad; }; static const dev_t base_dev = MKDEV(IB_UMAD_MAJOR, IB_UMAD_MINOR_BASE); @@ -114,10 +117,10 @@ int ret = 1; down_read(&file->agent_mutex); - for (packet->mad.id = 0; -packet->mad.id < IB_UMAD_MAX_AGENTS; -packet->mad.id++) - if (agent == file->agent[packet->mad.id]) { + for (packet->mad.hdr.id = 0; +packet->mad.hdr.id < IB_UMAD_MAX_AGENTS; +packet->mad.hdr.id++) + if (agent == file->agent[packet->mad.hdr.id]) { spin_lock_irq(&file->recv_lock); list_add_tail(&packet->list, &file->recv_list); spin_unlock_irq(&file->recv_lock); @@ -138,14 +141,11 @@ struct ib_umad_packet *packet = (void *) (unsigned long) send_wc->wr_id; - dma_unmap_single(agent->device->dma_device, -pci_unmap_addr(packet, mapping), -sizeof packet->mad.data, -DMA_TO_DEVICE); - ib_destroy_ah(packet->ah); + ib_free_send_mad(packet->msg); + ib_destroy_ah(packet->msg->send_wr.wr.ud.ah); if (send_wc->status == IB_WC_RESP_TIMEOUT_ERR) { - packet->mad.status = ETIMEDOUT; + packet->mad.hdr.status = ETIMEDOUT; if (!queue_packet(file, agent, packet)) return; @@ -159,30 +159,34 @@ { struct ib_umad_file *file = agent->context; struct ib_umad_packet *packet; + int length; + if (mad_recv_wc->wc->status != IB_WC_SUCCESS) goto out; - packet = kmalloc(sizeof *packet, GFP
[openib-general] [PATCH] user_mad: Support RMPP on send side
user_mad: Support RMPP on send side Note that this change will need a coordinated change to OpenSM and some userspace/management libraries which will be done as soon as possible once this patch is accepted. Receive side support for RMPP will be added separately. Signed-off-by: Hal Rosenstock <[EMAIL PROTECTED]> Index: infiniband/include/ib_user_mad.h === --- infiniband/include/ib_user_mad.h(revision 2331) +++ infiniband/include/ib_user_mad.h(working copy) @@ -1,5 +1,6 @@ /* * Copyright (c) 2004 Topspin Communications. All rights reserved. + * Copyright (c) 2005 Voltaire, Inc. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU @@ -42,7 +43,7 @@ * Increment this value if any changes that break userspace ABI * compatibility are made. */ -#define IB_USER_MAD_ABI_VERSION2 +#define IB_USER_MAD_ABI_VERSION3 /* * Make sure that all structs defined in this file remain laid out so @@ -51,8 +52,7 @@ */ /** - * ib_user_mad - MAD packet - * @data - Contents of MAD + * ib_user_mad_hdr - MAD packet header * @id - ID of agent MAD received with/to be sent with * @status - 0 on successful receive, ETIMEDOUT if no response * received (transaction ID in data[] will be set to TID of original @@ -72,8 +72,7 @@ * * All multi-byte quantities are stored in network (big endian) byte order. */ -struct ib_user_mad { - __u8data[256]; +struct ib_user_mad_hdr { __u32 id; __u32 status; __u32 timeout_ms; @@ -91,6 +90,17 @@ }; /** + * ib_user_mad - MAD packet + * @hdr - MAD packet header + * @data - Contents of MAD + * + */ +struct ib_user_mad { + struct ib_user_mad_hdr hdr; + __u8data[0]; +}; + +/** * ib_user_mad_reg_req - MAD registration request * @id - Set by the kernel; used to identify agent in future requests. * @qpn - Queue pair number; must be 0 or 1. @@ -103,6 +113,8 @@ * management class to receive. * @oui: Indicates IEEE OUI when mgmt_class is a vendor class * in the range from 0x30 to 0x4f. Otherwise not used. + * @rmpp_version: If set, indicates the RMPP version used. + * */ struct ib_user_mad_reg_req { __u32 id; @@ -111,6 +123,7 @@ __u8mgmt_class; __u8mgmt_class_version; __u8oui[3]; + __u8rmpp_version; }; #define IB_IOCTL_MAGIC 0x1b Index: infiniband/core/user_mad.c === --- infiniband/core/user_mad.c (revision 2331) +++ infiniband/core/user_mad.c (working copy) @@ -1,5 +1,6 @@ /* * Copyright (c) 2004 Topspin Communications. All rights reserved. + * Copyright (c) 2005 Voltaire, Inc. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU @@ -94,10 +95,12 @@ }; struct ib_umad_packet { - struct ib_user_mad mad; struct ib_ah *ah; + struct ib_mad_send_buf *msg; struct list_head list; + intlength; DECLARE_PCI_UNMAP_ADDR(mapping) + struct ib_user_mad mad; }; static const dev_t base_dev = MKDEV(IB_UMAD_MAJOR, IB_UMAD_MINOR_BASE); @@ -114,10 +117,10 @@ int ret = 1; down_read(&file->agent_mutex); - for (packet->mad.id = 0; -packet->mad.id < IB_UMAD_MAX_AGENTS; -packet->mad.id++) - if (agent == file->agent[packet->mad.id]) { + for (packet->mad.hdr.id = 0; +packet->mad.hdr.id < IB_UMAD_MAX_AGENTS; +packet->mad.hdr.id++) + if (agent == file->agent[packet->mad.hdr.id]) { spin_lock_irq(&file->recv_lock); list_add_tail(&packet->list, &file->recv_list); spin_unlock_irq(&file->recv_lock); @@ -138,14 +141,11 @@ struct ib_umad_packet *packet = (void *) (unsigned long) send_wc->wr_id; - dma_unmap_single(agent->device->dma_device, -pci_unmap_addr(packet, mapping), -sizeof packet->mad.data, -DMA_TO_DEVICE); - ib_destroy_ah(packet->ah); + ib_free_send_mad(packet->msg); + ib_destroy_ah(packet->msg->send_wr.wr.ud.ah); if (send_wc->status == IB_WC_RESP_TIMEOUT_ERR) { - packet->mad.status = ETIMEDOUT; + packet->mad.hdr.status = ETIMEDOUT; if (!queue_packet(file, agent, packet)) return; @@ -159,30 +159,34 @@ { struct ib_umad_file *file = agent->context; struct ib_umad_packet *packet; + int length; + if (mad_recv_wc->wc->status != IB_WC_SUCCESS) goto out; - packet = kmalloc(sizeof *packet, GFP