diff options
| -rw-r--r-- | Documentation/infiniband/user_mad.txt | 13 | ||||
| -rw-r--r-- | drivers/infiniband/core/agent.c | 4 | ||||
| -rw-r--r-- | drivers/infiniband/core/cm.c | 5 | ||||
| -rw-r--r-- | drivers/infiniband/core/mad.c | 4 | ||||
| -rw-r--r-- | drivers/infiniband/core/sa_query.c | 2 | ||||
| -rw-r--r-- | drivers/infiniband/core/user_mad.c | 120 | ||||
| -rw-r--r-- | drivers/infiniband/hw/mlx4/mad.c | 2 | ||||
| -rw-r--r-- | drivers/infiniband/hw/mthca/mthca_mad.c | 2 | ||||
| -rw-r--r-- | drivers/infiniband/hw/qib/qib_mad.c | 2 | ||||
| -rw-r--r-- | drivers/infiniband/ulp/srpt/ib_srpt.c | 2 | ||||
| -rw-r--r-- | include/rdma/ib_mad.h | 7 | ||||
| -rw-r--r-- | include/uapi/rdma/ib_user_mad.h | 39 |
12 files changed, 186 insertions, 16 deletions
diff --git a/Documentation/infiniband/user_mad.txt b/Documentation/infiniband/user_mad.txt index 8a366959f5cc..7aca13a54a3a 100644 --- a/Documentation/infiniband/user_mad.txt +++ b/Documentation/infiniband/user_mad.txt | |||
| @@ -26,6 +26,11 @@ Creating MAD agents | |||
| 26 | ioctl. Also, all agents registered through a file descriptor will | 26 | ioctl. Also, all agents registered through a file descriptor will |
| 27 | be unregistered when the descriptor is closed. | 27 | be unregistered when the descriptor is closed. |
| 28 | 28 | ||
| 29 | 2014 -- a new registration ioctl is now provided which allows additional | ||
| 30 | fields to be provided during registration. | ||
| 31 | Users of this registration call are implicitly setting the use of | ||
| 32 | pkey_index (see below). | ||
| 33 | |||
| 29 | Receiving MADs | 34 | Receiving MADs |
| 30 | 35 | ||
| 31 | MADs are received using read(). The receive side now supports | 36 | MADs are received using read(). The receive side now supports |
| @@ -104,10 +109,10 @@ P_Key Index Handling | |||
| 104 | The old ib_umad interface did not allow setting the P_Key index for | 109 | The old ib_umad interface did not allow setting the P_Key index for |
| 105 | MADs that are sent and did not provide a way for obtaining the P_Key | 110 | MADs that are sent and did not provide a way for obtaining the P_Key |
| 106 | index of received MADs. A new layout for struct ib_user_mad_hdr | 111 | index of received MADs. A new layout for struct ib_user_mad_hdr |
| 107 | with a pkey_index member has been defined; however, to preserve | 112 | with a pkey_index member has been defined; however, to preserve binary |
| 108 | binary compatibility with older applications, this new layout will | 113 | compatibility with older applications, this new layout will not be used |
| 109 | not be used unless the IB_USER_MAD_ENABLE_PKEY ioctl is called | 114 | unless one of IB_USER_MAD_ENABLE_PKEY or IB_USER_MAD_REGISTER_AGENT2 ioctl's |
| 110 | before a file descriptor is used for anything else. | 115 | are called before a file descriptor is used for anything else. |
| 111 | 116 | ||
| 112 | In September 2008, the IB_USER_MAD_ABI_VERSION will be incremented | 117 | In September 2008, the IB_USER_MAD_ABI_VERSION will be incremented |
| 113 | to 6, the new layout of struct ib_user_mad_hdr will be used by | 118 | to 6, the new layout of struct ib_user_mad_hdr will be used by |
diff --git a/drivers/infiniband/core/agent.c b/drivers/infiniband/core/agent.c index 8e32c5abd09d..f6d29614cb01 100644 --- a/drivers/infiniband/core/agent.c +++ b/drivers/infiniband/core/agent.c | |||
| @@ -161,7 +161,7 @@ int ib_agent_port_open(struct ib_device *device, int port_num) | |||
| 161 | port_priv->agent[0] = ib_register_mad_agent(device, port_num, | 161 | port_priv->agent[0] = ib_register_mad_agent(device, port_num, |
| 162 | IB_QPT_SMI, NULL, 0, | 162 | IB_QPT_SMI, NULL, 0, |
| 163 | &agent_send_handler, | 163 | &agent_send_handler, |
| 164 | NULL, NULL); | 164 | NULL, NULL, 0); |
| 165 | if (IS_ERR(port_priv->agent[0])) { | 165 | if (IS_ERR(port_priv->agent[0])) { |
| 166 | ret = PTR_ERR(port_priv->agent[0]); | 166 | ret = PTR_ERR(port_priv->agent[0]); |
| 167 | goto error2; | 167 | goto error2; |
| @@ -172,7 +172,7 @@ int ib_agent_port_open(struct ib_device *device, int port_num) | |||
| 172 | port_priv->agent[1] = ib_register_mad_agent(device, port_num, | 172 | port_priv->agent[1] = ib_register_mad_agent(device, port_num, |
| 173 | IB_QPT_GSI, NULL, 0, | 173 | IB_QPT_GSI, NULL, 0, |
| 174 | &agent_send_handler, | 174 | &agent_send_handler, |
| 175 | NULL, NULL); | 175 | NULL, NULL, 0); |
| 176 | if (IS_ERR(port_priv->agent[1])) { | 176 | if (IS_ERR(port_priv->agent[1])) { |
| 177 | ret = PTR_ERR(port_priv->agent[1]); | 177 | ret = PTR_ERR(port_priv->agent[1]); |
| 178 | goto error3; | 178 | goto error3; |
diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c index c3239170d8b7..e28a494e2a3a 100644 --- a/drivers/infiniband/core/cm.c +++ b/drivers/infiniband/core/cm.c | |||
| @@ -3753,7 +3753,7 @@ static void cm_add_one(struct ib_device *ib_device) | |||
| 3753 | struct cm_port *port; | 3753 | struct cm_port *port; |
| 3754 | struct ib_mad_reg_req reg_req = { | 3754 | struct ib_mad_reg_req reg_req = { |
| 3755 | .mgmt_class = IB_MGMT_CLASS_CM, | 3755 | .mgmt_class = IB_MGMT_CLASS_CM, |
| 3756 | .mgmt_class_version = IB_CM_CLASS_VERSION | 3756 | .mgmt_class_version = IB_CM_CLASS_VERSION, |
| 3757 | }; | 3757 | }; |
| 3758 | struct ib_port_modify port_modify = { | 3758 | struct ib_port_modify port_modify = { |
| 3759 | .set_port_cap_mask = IB_PORT_CM_SUP | 3759 | .set_port_cap_mask = IB_PORT_CM_SUP |
| @@ -3801,7 +3801,8 @@ static void cm_add_one(struct ib_device *ib_device) | |||
| 3801 | 0, | 3801 | 0, |
| 3802 | cm_send_handler, | 3802 | cm_send_handler, |
| 3803 | cm_recv_handler, | 3803 | cm_recv_handler, |
| 3804 | port); | 3804 | port, |
| 3805 | 0); | ||
| 3805 | if (IS_ERR(port->mad_agent)) | 3806 | if (IS_ERR(port->mad_agent)) |
| 3806 | goto error2; | 3807 | goto error2; |
| 3807 | 3808 | ||
diff --git a/drivers/infiniband/core/mad.c b/drivers/infiniband/core/mad.c index f46995d4f54b..988bbda67952 100644 --- a/drivers/infiniband/core/mad.c +++ b/drivers/infiniband/core/mad.c | |||
| @@ -198,7 +198,8 @@ struct ib_mad_agent *ib_register_mad_agent(struct ib_device *device, | |||
| 198 | u8 rmpp_version, | 198 | u8 rmpp_version, |
| 199 | ib_mad_send_handler send_handler, | 199 | ib_mad_send_handler send_handler, |
| 200 | ib_mad_recv_handler recv_handler, | 200 | ib_mad_recv_handler recv_handler, |
| 201 | void *context) | 201 | void *context, |
| 202 | u32 registration_flags) | ||
| 202 | { | 203 | { |
| 203 | struct ib_mad_port_private *port_priv; | 204 | struct ib_mad_port_private *port_priv; |
| 204 | struct ib_mad_agent *ret = ERR_PTR(-EINVAL); | 205 | struct ib_mad_agent *ret = ERR_PTR(-EINVAL); |
| @@ -359,6 +360,7 @@ struct ib_mad_agent *ib_register_mad_agent(struct ib_device *device, | |||
| 359 | mad_agent_priv->agent.context = context; | 360 | mad_agent_priv->agent.context = context; |
| 360 | mad_agent_priv->agent.qp = port_priv->qp_info[qpn].qp; | 361 | mad_agent_priv->agent.qp = port_priv->qp_info[qpn].qp; |
| 361 | mad_agent_priv->agent.port_num = port_num; | 362 | mad_agent_priv->agent.port_num = port_num; |
| 363 | mad_agent_priv->agent.flags = registration_flags; | ||
| 362 | spin_lock_init(&mad_agent_priv->lock); | 364 | spin_lock_init(&mad_agent_priv->lock); |
| 363 | INIT_LIST_HEAD(&mad_agent_priv->send_list); | 365 | INIT_LIST_HEAD(&mad_agent_priv->send_list); |
| 364 | INIT_LIST_HEAD(&mad_agent_priv->wait_list); | 366 | INIT_LIST_HEAD(&mad_agent_priv->wait_list); |
diff --git a/drivers/infiniband/core/sa_query.c b/drivers/infiniband/core/sa_query.c index 233eaf541f55..c38f030f0dc9 100644 --- a/drivers/infiniband/core/sa_query.c +++ b/drivers/infiniband/core/sa_query.c | |||
| @@ -1184,7 +1184,7 @@ static void ib_sa_add_one(struct ib_device *device) | |||
| 1184 | sa_dev->port[i].agent = | 1184 | sa_dev->port[i].agent = |
| 1185 | ib_register_mad_agent(device, i + s, IB_QPT_GSI, | 1185 | ib_register_mad_agent(device, i + s, IB_QPT_GSI, |
| 1186 | NULL, 0, send_handler, | 1186 | NULL, 0, send_handler, |
| 1187 | recv_handler, sa_dev); | 1187 | recv_handler, sa_dev, 0); |
| 1188 | if (IS_ERR(sa_dev->port[i].agent)) | 1188 | if (IS_ERR(sa_dev->port[i].agent)) |
| 1189 | goto err; | 1189 | goto err; |
| 1190 | 1190 | ||
diff --git a/drivers/infiniband/core/user_mad.c b/drivers/infiniband/core/user_mad.c index ea90a3ebb9c2..11af1c61c135 100644 --- a/drivers/infiniband/core/user_mad.c +++ b/drivers/infiniband/core/user_mad.c | |||
| @@ -647,6 +647,7 @@ static int ib_umad_reg_agent(struct ib_umad_file *file, void __user *arg, | |||
| 647 | 647 | ||
| 648 | found: | 648 | found: |
| 649 | if (ureq.mgmt_class) { | 649 | if (ureq.mgmt_class) { |
| 650 | memset(&req, 0, sizeof(req)); | ||
| 650 | req.mgmt_class = ureq.mgmt_class; | 651 | req.mgmt_class = ureq.mgmt_class; |
| 651 | req.mgmt_class_version = ureq.mgmt_class_version; | 652 | req.mgmt_class_version = ureq.mgmt_class_version; |
| 652 | memcpy(req.oui, ureq.oui, sizeof req.oui); | 653 | memcpy(req.oui, ureq.oui, sizeof req.oui); |
| @@ -667,7 +668,7 @@ found: | |||
| 667 | ureq.qpn ? IB_QPT_GSI : IB_QPT_SMI, | 668 | ureq.qpn ? IB_QPT_GSI : IB_QPT_SMI, |
| 668 | ureq.mgmt_class ? &req : NULL, | 669 | ureq.mgmt_class ? &req : NULL, |
| 669 | ureq.rmpp_version, | 670 | ureq.rmpp_version, |
| 670 | send_handler, recv_handler, file); | 671 | send_handler, recv_handler, file, 0); |
| 671 | if (IS_ERR(agent)) { | 672 | if (IS_ERR(agent)) { |
| 672 | ret = PTR_ERR(agent); | 673 | ret = PTR_ERR(agent); |
| 673 | agent = NULL; | 674 | agent = NULL; |
| @@ -705,6 +706,119 @@ out: | |||
| 705 | return ret; | 706 | return ret; |
| 706 | } | 707 | } |
| 707 | 708 | ||
| 709 | static int ib_umad_reg_agent2(struct ib_umad_file *file, void __user *arg) | ||
| 710 | { | ||
| 711 | struct ib_user_mad_reg_req2 ureq; | ||
| 712 | struct ib_mad_reg_req req; | ||
| 713 | struct ib_mad_agent *agent = NULL; | ||
| 714 | int agent_id; | ||
| 715 | int ret; | ||
| 716 | |||
| 717 | mutex_lock(&file->port->file_mutex); | ||
| 718 | mutex_lock(&file->mutex); | ||
| 719 | |||
| 720 | if (!file->port->ib_dev) { | ||
| 721 | dev_notice(file->port->dev, | ||
| 722 | "ib_umad_reg_agent2: invalid device\n"); | ||
| 723 | ret = -EPIPE; | ||
| 724 | goto out; | ||
| 725 | } | ||
| 726 | |||
| 727 | if (copy_from_user(&ureq, arg, sizeof(ureq))) { | ||
| 728 | ret = -EFAULT; | ||
| 729 | goto out; | ||
| 730 | } | ||
| 731 | |||
| 732 | if (ureq.qpn != 0 && ureq.qpn != 1) { | ||
| 733 | dev_notice(file->port->dev, | ||
| 734 | "ib_umad_reg_agent2: invalid QPN %d specified\n", | ||
| 735 | ureq.qpn); | ||
| 736 | ret = -EINVAL; | ||
| 737 | goto out; | ||
| 738 | } | ||
| 739 | |||
| 740 | if (ureq.flags & ~IB_USER_MAD_REG_FLAGS_CAP) { | ||
| 741 | dev_notice(file->port->dev, | ||
| 742 | "ib_umad_reg_agent2 failed: invalid registration flags specified 0x%x; supported 0x%x\n", | ||
| 743 | ureq.flags, IB_USER_MAD_REG_FLAGS_CAP); | ||
| 744 | ret = -EINVAL; | ||
| 745 | |||
| 746 | if (put_user((u32)IB_USER_MAD_REG_FLAGS_CAP, | ||
| 747 | (u32 __user *) (arg + offsetof(struct | ||
| 748 | ib_user_mad_reg_req2, flags)))) | ||
| 749 | ret = -EFAULT; | ||
| 750 | |||
| 751 | goto out; | ||
| 752 | } | ||
| 753 | |||
| 754 | for (agent_id = 0; agent_id < IB_UMAD_MAX_AGENTS; ++agent_id) | ||
| 755 | if (!__get_agent(file, agent_id)) | ||
| 756 | goto found; | ||
| 757 | |||
| 758 | dev_notice(file->port->dev, | ||
| 759 | "ib_umad_reg_agent2: Max Agents (%u) reached\n", | ||
| 760 | IB_UMAD_MAX_AGENTS); | ||
| 761 | ret = -ENOMEM; | ||
| 762 | goto out; | ||
| 763 | |||
| 764 | found: | ||
| 765 | if (ureq.mgmt_class) { | ||
| 766 | memset(&req, 0, sizeof(req)); | ||
| 767 | req.mgmt_class = ureq.mgmt_class; | ||
| 768 | req.mgmt_class_version = ureq.mgmt_class_version; | ||
| 769 | if (ureq.oui & 0xff000000) { | ||
| 770 | dev_notice(file->port->dev, | ||
| 771 | "ib_umad_reg_agent2 failed: oui invalid 0x%08x\n", | ||
| 772 | ureq.oui); | ||
| 773 | ret = -EINVAL; | ||
| 774 | goto out; | ||
| 775 | } | ||
| 776 | req.oui[2] = ureq.oui & 0x0000ff; | ||
| 777 | req.oui[1] = (ureq.oui & 0x00ff00) >> 8; | ||
| 778 | req.oui[0] = (ureq.oui & 0xff0000) >> 16; | ||
| 779 | memcpy(req.method_mask, ureq.method_mask, | ||
| 780 | sizeof(req.method_mask)); | ||
| 781 | } | ||
| 782 | |||
| 783 | agent = ib_register_mad_agent(file->port->ib_dev, file->port->port_num, | ||
| 784 | ureq.qpn ? IB_QPT_GSI : IB_QPT_SMI, | ||
| 785 | ureq.mgmt_class ? &req : NULL, | ||
| 786 | ureq.rmpp_version, | ||
| 787 | send_handler, recv_handler, file, | ||
| 788 | ureq.flags); | ||
| 789 | if (IS_ERR(agent)) { | ||
| 790 | ret = PTR_ERR(agent); | ||
| 791 | agent = NULL; | ||
| 792 | goto out; | ||
| 793 | } | ||
| 794 | |||
| 795 | if (put_user(agent_id, | ||
| 796 | (u32 __user *)(arg + | ||
| 797 | offsetof(struct ib_user_mad_reg_req2, id)))) { | ||
| 798 | ret = -EFAULT; | ||
| 799 | goto out; | ||
| 800 | } | ||
| 801 | |||
| 802 | if (!file->already_used) { | ||
| 803 | file->already_used = 1; | ||
| 804 | file->use_pkey_index = 1; | ||
| 805 | } | ||
| 806 | |||
| 807 | file->agent[agent_id] = agent; | ||
| 808 | ret = 0; | ||
| 809 | |||
| 810 | out: | ||
| 811 | mutex_unlock(&file->mutex); | ||
| 812 | |||
| 813 | if (ret && agent) | ||
| 814 | ib_unregister_mad_agent(agent); | ||
| 815 | |||
| 816 | mutex_unlock(&file->port->file_mutex); | ||
| 817 | |||
| 818 | return ret; | ||
| 819 | } | ||
| 820 | |||
| 821 | |||
| 708 | static int ib_umad_unreg_agent(struct ib_umad_file *file, u32 __user *arg) | 822 | static int ib_umad_unreg_agent(struct ib_umad_file *file, u32 __user *arg) |
| 709 | { | 823 | { |
| 710 | struct ib_mad_agent *agent = NULL; | 824 | struct ib_mad_agent *agent = NULL; |
| @@ -760,6 +874,8 @@ static long ib_umad_ioctl(struct file *filp, unsigned int cmd, | |||
| 760 | return ib_umad_unreg_agent(filp->private_data, (__u32 __user *) arg); | 874 | return ib_umad_unreg_agent(filp->private_data, (__u32 __user *) arg); |
| 761 | case IB_USER_MAD_ENABLE_PKEY: | 875 | case IB_USER_MAD_ENABLE_PKEY: |
| 762 | return ib_umad_enable_pkey(filp->private_data); | 876 | return ib_umad_enable_pkey(filp->private_data); |
| 877 | case IB_USER_MAD_REGISTER_AGENT2: | ||
| 878 | return ib_umad_reg_agent2(filp->private_data, (void __user *) arg); | ||
| 763 | default: | 879 | default: |
| 764 | return -ENOIOCTLCMD; | 880 | return -ENOIOCTLCMD; |
| 765 | } | 881 | } |
| @@ -776,6 +892,8 @@ static long ib_umad_compat_ioctl(struct file *filp, unsigned int cmd, | |||
| 776 | return ib_umad_unreg_agent(filp->private_data, compat_ptr(arg)); | 892 | return ib_umad_unreg_agent(filp->private_data, compat_ptr(arg)); |
| 777 | case IB_USER_MAD_ENABLE_PKEY: | 893 | case IB_USER_MAD_ENABLE_PKEY: |
| 778 | return ib_umad_enable_pkey(filp->private_data); | 894 | return ib_umad_enable_pkey(filp->private_data); |
| 895 | case IB_USER_MAD_REGISTER_AGENT2: | ||
| 896 | return ib_umad_reg_agent2(filp->private_data, compat_ptr(arg)); | ||
| 779 | default: | 897 | default: |
| 780 | return -ENOIOCTLCMD; | 898 | return -ENOIOCTLCMD; |
| 781 | } | 899 | } |
diff --git a/drivers/infiniband/hw/mlx4/mad.c b/drivers/infiniband/hw/mlx4/mad.c index 287ad0564acd..82a7dd87089b 100644 --- a/drivers/infiniband/hw/mlx4/mad.c +++ b/drivers/infiniband/hw/mlx4/mad.c | |||
| @@ -891,7 +891,7 @@ int mlx4_ib_mad_init(struct mlx4_ib_dev *dev) | |||
| 891 | agent = ib_register_mad_agent(&dev->ib_dev, p + 1, | 891 | agent = ib_register_mad_agent(&dev->ib_dev, p + 1, |
| 892 | q ? IB_QPT_GSI : IB_QPT_SMI, | 892 | q ? IB_QPT_GSI : IB_QPT_SMI, |
| 893 | NULL, 0, send_handler, | 893 | NULL, 0, send_handler, |
| 894 | NULL, NULL); | 894 | NULL, NULL, 0); |
| 895 | if (IS_ERR(agent)) { | 895 | if (IS_ERR(agent)) { |
| 896 | ret = PTR_ERR(agent); | 896 | ret = PTR_ERR(agent); |
| 897 | goto err; | 897 | goto err; |
diff --git a/drivers/infiniband/hw/mthca/mthca_mad.c b/drivers/infiniband/hw/mthca/mthca_mad.c index b6f7f457fc55..8881fa376e06 100644 --- a/drivers/infiniband/hw/mthca/mthca_mad.c +++ b/drivers/infiniband/hw/mthca/mthca_mad.c | |||
| @@ -294,7 +294,7 @@ int mthca_create_agents(struct mthca_dev *dev) | |||
| 294 | agent = ib_register_mad_agent(&dev->ib_dev, p + 1, | 294 | agent = ib_register_mad_agent(&dev->ib_dev, p + 1, |
| 295 | q ? IB_QPT_GSI : IB_QPT_SMI, | 295 | q ? IB_QPT_GSI : IB_QPT_SMI, |
| 296 | NULL, 0, send_handler, | 296 | NULL, 0, send_handler, |
| 297 | NULL, NULL); | 297 | NULL, NULL, 0); |
| 298 | if (IS_ERR(agent)) { | 298 | if (IS_ERR(agent)) { |
| 299 | ret = PTR_ERR(agent); | 299 | ret = PTR_ERR(agent); |
| 300 | goto err; | 300 | goto err; |
diff --git a/drivers/infiniband/hw/qib/qib_mad.c b/drivers/infiniband/hw/qib/qib_mad.c index 22c720e5740d..636be117b578 100644 --- a/drivers/infiniband/hw/qib/qib_mad.c +++ b/drivers/infiniband/hw/qib/qib_mad.c | |||
| @@ -2476,7 +2476,7 @@ int qib_create_agents(struct qib_ibdev *dev) | |||
| 2476 | ibp = &dd->pport[p].ibport_data; | 2476 | ibp = &dd->pport[p].ibport_data; |
| 2477 | agent = ib_register_mad_agent(&dev->ibdev, p + 1, IB_QPT_SMI, | 2477 | agent = ib_register_mad_agent(&dev->ibdev, p + 1, IB_QPT_SMI, |
| 2478 | NULL, 0, send_handler, | 2478 | NULL, 0, send_handler, |
| 2479 | NULL, NULL); | 2479 | NULL, NULL, 0); |
| 2480 | if (IS_ERR(agent)) { | 2480 | if (IS_ERR(agent)) { |
| 2481 | ret = PTR_ERR(agent); | 2481 | ret = PTR_ERR(agent); |
| 2482 | goto err; | 2482 | goto err; |
diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c index fe09f2788b15..8a8311e35cbd 100644 --- a/drivers/infiniband/ulp/srpt/ib_srpt.c +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c | |||
| @@ -563,7 +563,7 @@ static int srpt_refresh_port(struct srpt_port *sport) | |||
| 563 | ®_req, 0, | 563 | ®_req, 0, |
| 564 | srpt_mad_send_handler, | 564 | srpt_mad_send_handler, |
| 565 | srpt_mad_recv_handler, | 565 | srpt_mad_recv_handler, |
| 566 | sport); | 566 | sport, 0); |
| 567 | if (IS_ERR(sport->mad_agent)) { | 567 | if (IS_ERR(sport->mad_agent)) { |
| 568 | ret = PTR_ERR(sport->mad_agent); | 568 | ret = PTR_ERR(sport->mad_agent); |
| 569 | sport->mad_agent = NULL; | 569 | sport->mad_agent = NULL; |
diff --git a/include/rdma/ib_mad.h b/include/rdma/ib_mad.h index 3d81b90cc315..876f497f8b0c 100644 --- a/include/rdma/ib_mad.h +++ b/include/rdma/ib_mad.h | |||
| @@ -355,6 +355,7 @@ typedef void (*ib_mad_recv_handler)(struct ib_mad_agent *mad_agent, | |||
| 355 | * @hi_tid: Access layer assigned transaction ID for this client. | 355 | * @hi_tid: Access layer assigned transaction ID for this client. |
| 356 | * Unsolicited MADs sent by this client will have the upper 32-bits | 356 | * Unsolicited MADs sent by this client will have the upper 32-bits |
| 357 | * of their TID set to this value. | 357 | * of their TID set to this value. |
| 358 | * @flags: registration flags | ||
| 358 | * @port_num: Port number on which QP is registered | 359 | * @port_num: Port number on which QP is registered |
| 359 | * @rmpp_version: If set, indicates the RMPP version used by this agent. | 360 | * @rmpp_version: If set, indicates the RMPP version used by this agent. |
| 360 | */ | 361 | */ |
| @@ -367,6 +368,7 @@ struct ib_mad_agent { | |||
| 367 | ib_mad_snoop_handler snoop_handler; | 368 | ib_mad_snoop_handler snoop_handler; |
| 368 | void *context; | 369 | void *context; |
| 369 | u32 hi_tid; | 370 | u32 hi_tid; |
| 371 | u32 flags; | ||
| 370 | u8 port_num; | 372 | u8 port_num; |
| 371 | u8 rmpp_version; | 373 | u8 rmpp_version; |
| 372 | }; | 374 | }; |
| @@ -426,6 +428,7 @@ struct ib_mad_recv_wc { | |||
| 426 | * in the range from 0x30 to 0x4f. Otherwise not used. | 428 | * in the range from 0x30 to 0x4f. Otherwise not used. |
| 427 | * @method_mask: The caller will receive unsolicited MADs for any method | 429 | * @method_mask: The caller will receive unsolicited MADs for any method |
| 428 | * where @method_mask = 1. | 430 | * where @method_mask = 1. |
| 431 | * | ||
| 429 | */ | 432 | */ |
| 430 | struct ib_mad_reg_req { | 433 | struct ib_mad_reg_req { |
| 431 | u8 mgmt_class; | 434 | u8 mgmt_class; |
| @@ -451,6 +454,7 @@ struct ib_mad_reg_req { | |||
| 451 | * @recv_handler: The completion callback routine invoked for a received | 454 | * @recv_handler: The completion callback routine invoked for a received |
| 452 | * MAD. | 455 | * MAD. |
| 453 | * @context: User specified context associated with the registration. | 456 | * @context: User specified context associated with the registration. |
| 457 | * @registration_flags: Registration flags to set for this agent | ||
| 454 | */ | 458 | */ |
| 455 | struct ib_mad_agent *ib_register_mad_agent(struct ib_device *device, | 459 | struct ib_mad_agent *ib_register_mad_agent(struct ib_device *device, |
| 456 | u8 port_num, | 460 | u8 port_num, |
| @@ -459,7 +463,8 @@ struct ib_mad_agent *ib_register_mad_agent(struct ib_device *device, | |||
| 459 | u8 rmpp_version, | 463 | u8 rmpp_version, |
| 460 | ib_mad_send_handler send_handler, | 464 | ib_mad_send_handler send_handler, |
| 461 | ib_mad_recv_handler recv_handler, | 465 | ib_mad_recv_handler recv_handler, |
| 462 | void *context); | 466 | void *context, |
| 467 | u32 registration_flags); | ||
| 463 | 468 | ||
| 464 | enum ib_mad_snoop_flags { | 469 | enum ib_mad_snoop_flags { |
| 465 | /*IB_MAD_SNOOP_POSTED_SENDS = 1,*/ | 470 | /*IB_MAD_SNOOP_POSTED_SENDS = 1,*/ |
diff --git a/include/uapi/rdma/ib_user_mad.h b/include/uapi/rdma/ib_user_mad.h index d6fce1cbdb90..c00b081dc10e 100644 --- a/include/uapi/rdma/ib_user_mad.h +++ b/include/uapi/rdma/ib_user_mad.h | |||
| @@ -191,6 +191,42 @@ struct ib_user_mad_reg_req { | |||
| 191 | __u8 rmpp_version; | 191 | __u8 rmpp_version; |
| 192 | }; | 192 | }; |
| 193 | 193 | ||
| 194 | /** | ||
| 195 | * ib_user_mad_reg_req2 - MAD registration request | ||
| 196 | * | ||
| 197 | * @id - Set by the _kernel_; used by userspace to identify the | ||
| 198 | * registered agent in future requests. | ||
| 199 | * @qpn - Queue pair number; must be 0 or 1. | ||
| 200 | * @mgmt_class - Indicates which management class of MADs should be | ||
| 201 | * receive by the caller. This field is only required if | ||
| 202 | * the user wishes to receive unsolicited MADs, otherwise | ||
| 203 | * it should be 0. | ||
| 204 | * @mgmt_class_version - Indicates which version of MADs for the given | ||
| 205 | * management class to receive. | ||
| 206 | * @res - Ignored. | ||
| 207 | * @flags - additional registration flags; Must be in the set of | ||
| 208 | * flags defined in IB_USER_MAD_REG_FLAGS_CAP | ||
| 209 | * @method_mask - The caller wishes to receive unsolicited MADs for the | ||
| 210 | * methods whose bit(s) is(are) set. | ||
| 211 | * @oui - Indicates IEEE OUI to use when mgmt_class is a vendor | ||
| 212 | * class in the range from 0x30 to 0x4f. Otherwise not | ||
| 213 | * used. | ||
| 214 | * @rmpp_version - If set, indicates the RMPP version to use. | ||
| 215 | */ | ||
| 216 | #define IB_USER_MAD_REG_FLAGS_CAP (0) | ||
| 217 | struct ib_user_mad_reg_req2 { | ||
| 218 | __u32 id; | ||
| 219 | __u32 qpn; | ||
| 220 | __u8 mgmt_class; | ||
| 221 | __u8 mgmt_class_version; | ||
| 222 | __u16 res; | ||
| 223 | __u32 flags; | ||
| 224 | __u64 method_mask[2]; | ||
| 225 | __u32 oui; | ||
| 226 | __u8 rmpp_version; | ||
| 227 | __u8 reserved[3]; | ||
| 228 | }; | ||
| 229 | |||
| 194 | #define IB_IOCTL_MAGIC 0x1b | 230 | #define IB_IOCTL_MAGIC 0x1b |
| 195 | 231 | ||
| 196 | #define IB_USER_MAD_REGISTER_AGENT _IOWR(IB_IOCTL_MAGIC, 1, \ | 232 | #define IB_USER_MAD_REGISTER_AGENT _IOWR(IB_IOCTL_MAGIC, 1, \ |
| @@ -200,4 +236,7 @@ struct ib_user_mad_reg_req { | |||
| 200 | 236 | ||
| 201 | #define IB_USER_MAD_ENABLE_PKEY _IO(IB_IOCTL_MAGIC, 3) | 237 | #define IB_USER_MAD_ENABLE_PKEY _IO(IB_IOCTL_MAGIC, 3) |
| 202 | 238 | ||
| 239 | #define IB_USER_MAD_REGISTER_AGENT2 _IOWR(IB_IOCTL_MAGIC, 4, \ | ||
| 240 | struct ib_user_mad_reg_req2) | ||
| 241 | |||
| 203 | #endif /* IB_USER_MAD_H */ | 242 | #endif /* IB_USER_MAD_H */ |
