diff options
author | Hal Rosenstock <halr@voltaire.com> | 2005-07-27 14:45:25 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-07-27 19:26:10 -0400 |
commit | d760ce8f71ec5336c4a750a1293f26c0eb938c8a (patch) | |
tree | 44a4ce8a53c40ac41c614b4a6283890074ce9c1c /drivers/infiniband/core | |
parent | f8197a4ed1bba8c80ed6ddf4535ded80cb4152cf (diff) |
[PATCH] IB: Change ib_mad_send_wr_private struct
Have ib_mad_send_wr_private reference the private agent structure directly,
rather than the exposed agent definition. Remove unneeded parameters to
functions and simplify code were possible from this change.
Signed-off-by: Sean Hefty <sean.hefty@intel.com>
Signed-off-by: Hal Rosenstock <halr@voltaire.com>
Cc: Roland Dreier <rolandd@cisco.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/infiniband/core')
-rw-r--r-- | drivers/infiniband/core/mad.c | 22 | ||||
-rw-r--r-- | drivers/infiniband/core/mad_priv.h | 4 |
2 files changed, 12 insertions, 14 deletions
diff --git a/drivers/infiniband/core/mad.c b/drivers/infiniband/core/mad.c index 5535a45a8548..d1898b30c345 100644 --- a/drivers/infiniband/core/mad.c +++ b/drivers/infiniband/core/mad.c | |||
@@ -839,8 +839,7 @@ void ib_free_send_mad(struct ib_mad_send_buf *send_buf) | |||
839 | } | 839 | } |
840 | EXPORT_SYMBOL(ib_free_send_mad); | 840 | EXPORT_SYMBOL(ib_free_send_mad); |
841 | 841 | ||
842 | static int ib_send_mad(struct ib_mad_agent_private *mad_agent_priv, | 842 | static int ib_send_mad(struct ib_mad_send_wr_private *mad_send_wr) |
843 | struct ib_mad_send_wr_private *mad_send_wr) | ||
844 | { | 843 | { |
845 | struct ib_mad_qp_info *qp_info; | 844 | struct ib_mad_qp_info *qp_info; |
846 | struct ib_send_wr *bad_send_wr; | 845 | struct ib_send_wr *bad_send_wr; |
@@ -848,7 +847,7 @@ static int ib_send_mad(struct ib_mad_agent_private *mad_agent_priv, | |||
848 | int ret; | 847 | int ret; |
849 | 848 | ||
850 | /* Set WR ID to find mad_send_wr upon completion */ | 849 | /* Set WR ID to find mad_send_wr upon completion */ |
851 | qp_info = mad_agent_priv->qp_info; | 850 | qp_info = mad_send_wr->mad_agent_priv->qp_info; |
852 | mad_send_wr->send_wr.wr_id = (unsigned long)&mad_send_wr->mad_list; | 851 | mad_send_wr->send_wr.wr_id = (unsigned long)&mad_send_wr->mad_list; |
853 | mad_send_wr->mad_list.mad_queue = &qp_info->send_queue; | 852 | mad_send_wr->mad_list.mad_queue = &qp_info->send_queue; |
854 | 853 | ||
@@ -857,7 +856,7 @@ static int ib_send_mad(struct ib_mad_agent_private *mad_agent_priv, | |||
857 | list_add_tail(&mad_send_wr->mad_list.list, | 856 | list_add_tail(&mad_send_wr->mad_list.list, |
858 | &qp_info->send_queue.list); | 857 | &qp_info->send_queue.list); |
859 | spin_unlock_irqrestore(&qp_info->send_queue.lock, flags); | 858 | spin_unlock_irqrestore(&qp_info->send_queue.lock, flags); |
860 | ret = ib_post_send(mad_agent_priv->agent.qp, | 859 | ret = ib_post_send(mad_send_wr->mad_agent_priv->agent.qp, |
861 | &mad_send_wr->send_wr, &bad_send_wr); | 860 | &mad_send_wr->send_wr, &bad_send_wr); |
862 | if (ret) { | 861 | if (ret) { |
863 | printk(KERN_ERR PFX "ib_post_send failed: %d\n", ret); | 862 | printk(KERN_ERR PFX "ib_post_send failed: %d\n", ret); |
@@ -950,7 +949,7 @@ int ib_post_send_mad(struct ib_mad_agent *mad_agent, | |||
950 | mad_send_wr->wr_id = mad_send_wr->send_wr.wr_id; | 949 | mad_send_wr->wr_id = mad_send_wr->send_wr.wr_id; |
951 | mad_send_wr->send_wr.next = NULL; | 950 | mad_send_wr->send_wr.next = NULL; |
952 | mad_send_wr->tid = send_wr->wr.ud.mad_hdr->tid; | 951 | mad_send_wr->tid = send_wr->wr.ud.mad_hdr->tid; |
953 | mad_send_wr->agent = mad_agent; | 952 | mad_send_wr->mad_agent_priv = mad_agent_priv; |
954 | /* Timeout will be updated after send completes */ | 953 | /* Timeout will be updated after send completes */ |
955 | mad_send_wr->timeout = msecs_to_jiffies(send_wr->wr. | 954 | mad_send_wr->timeout = msecs_to_jiffies(send_wr->wr. |
956 | ud.timeout_ms); | 955 | ud.timeout_ms); |
@@ -966,7 +965,7 @@ int ib_post_send_mad(struct ib_mad_agent *mad_agent, | |||
966 | &mad_agent_priv->send_list); | 965 | &mad_agent_priv->send_list); |
967 | spin_unlock_irqrestore(&mad_agent_priv->lock, flags); | 966 | spin_unlock_irqrestore(&mad_agent_priv->lock, flags); |
968 | 967 | ||
969 | ret = ib_send_mad(mad_agent_priv, mad_send_wr); | 968 | ret = ib_send_mad(mad_send_wr); |
970 | if (ret) { | 969 | if (ret) { |
971 | /* Fail send request */ | 970 | /* Fail send request */ |
972 | spin_lock_irqsave(&mad_agent_priv->lock, flags); | 971 | spin_lock_irqsave(&mad_agent_priv->lock, flags); |
@@ -1742,13 +1741,14 @@ static void adjust_timeout(struct ib_mad_agent_private *mad_agent_priv) | |||
1742 | } | 1741 | } |
1743 | } | 1742 | } |
1744 | 1743 | ||
1745 | static void wait_for_response(struct ib_mad_agent_private *mad_agent_priv, | 1744 | static void wait_for_response(struct ib_mad_send_wr_private *mad_send_wr) |
1746 | struct ib_mad_send_wr_private *mad_send_wr ) | ||
1747 | { | 1745 | { |
1746 | struct ib_mad_agent_private *mad_agent_priv; | ||
1748 | struct ib_mad_send_wr_private *temp_mad_send_wr; | 1747 | struct ib_mad_send_wr_private *temp_mad_send_wr; |
1749 | struct list_head *list_item; | 1748 | struct list_head *list_item; |
1750 | unsigned long delay; | 1749 | unsigned long delay; |
1751 | 1750 | ||
1751 | mad_agent_priv = mad_send_wr->mad_agent_priv; | ||
1752 | list_del(&mad_send_wr->agent_list); | 1752 | list_del(&mad_send_wr->agent_list); |
1753 | 1753 | ||
1754 | delay = mad_send_wr->timeout; | 1754 | delay = mad_send_wr->timeout; |
@@ -1781,9 +1781,7 @@ static void ib_mad_complete_send_wr(struct ib_mad_send_wr_private *mad_send_wr, | |||
1781 | struct ib_mad_agent_private *mad_agent_priv; | 1781 | struct ib_mad_agent_private *mad_agent_priv; |
1782 | unsigned long flags; | 1782 | unsigned long flags; |
1783 | 1783 | ||
1784 | mad_agent_priv = container_of(mad_send_wr->agent, | 1784 | mad_agent_priv = mad_send_wr->mad_agent_priv; |
1785 | struct ib_mad_agent_private, agent); | ||
1786 | |||
1787 | spin_lock_irqsave(&mad_agent_priv->lock, flags); | 1785 | spin_lock_irqsave(&mad_agent_priv->lock, flags); |
1788 | if (mad_send_wc->status != IB_WC_SUCCESS && | 1786 | if (mad_send_wc->status != IB_WC_SUCCESS && |
1789 | mad_send_wr->status == IB_WC_SUCCESS) { | 1787 | mad_send_wr->status == IB_WC_SUCCESS) { |
@@ -1794,7 +1792,7 @@ static void ib_mad_complete_send_wr(struct ib_mad_send_wr_private *mad_send_wr, | |||
1794 | if (--mad_send_wr->refcount > 0) { | 1792 | if (--mad_send_wr->refcount > 0) { |
1795 | if (mad_send_wr->refcount == 1 && mad_send_wr->timeout && | 1793 | if (mad_send_wr->refcount == 1 && mad_send_wr->timeout && |
1796 | mad_send_wr->status == IB_WC_SUCCESS) { | 1794 | mad_send_wr->status == IB_WC_SUCCESS) { |
1797 | wait_for_response(mad_agent_priv, mad_send_wr); | 1795 | wait_for_response(mad_send_wr); |
1798 | } | 1796 | } |
1799 | spin_unlock_irqrestore(&mad_agent_priv->lock, flags); | 1797 | spin_unlock_irqrestore(&mad_agent_priv->lock, flags); |
1800 | return; | 1798 | return; |
diff --git a/drivers/infiniband/core/mad_priv.h b/drivers/infiniband/core/mad_priv.h index 008cbcb94b15..96f1b5b610c2 100644 --- a/drivers/infiniband/core/mad_priv.h +++ b/drivers/infiniband/core/mad_priv.h | |||
@@ -29,7 +29,7 @@ | |||
29 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | 29 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
30 | * SOFTWARE. | 30 | * SOFTWARE. |
31 | * | 31 | * |
32 | * $Id: mad_priv.h 1389 2004-12-27 22:56:47Z roland $ | 32 | * $Id: mad_priv.h 1980 2005-03-11 22:33:53Z sean.hefty $ |
33 | */ | 33 | */ |
34 | 34 | ||
35 | #ifndef __IB_MAD_PRIV_H__ | 35 | #ifndef __IB_MAD_PRIV_H__ |
@@ -116,7 +116,7 @@ struct ib_mad_snoop_private { | |||
116 | struct ib_mad_send_wr_private { | 116 | struct ib_mad_send_wr_private { |
117 | struct ib_mad_list_head mad_list; | 117 | struct ib_mad_list_head mad_list; |
118 | struct list_head agent_list; | 118 | struct list_head agent_list; |
119 | struct ib_mad_agent *agent; | 119 | struct ib_mad_agent_private *mad_agent_priv; |
120 | struct ib_send_wr send_wr; | 120 | struct ib_send_wr send_wr; |
121 | struct ib_sge sg_list[IB_MAD_SEND_REQ_MAX_SG]; | 121 | struct ib_sge sg_list[IB_MAD_SEND_REQ_MAX_SG]; |
122 | u64 wr_id; /* client WR ID */ | 122 | u64 wr_id; /* client WR ID */ |