diff options
Diffstat (limited to 'drivers/infiniband')
-rw-r--r-- | drivers/infiniband/core/mad.c | 6 | ||||
-rw-r--r-- | drivers/infiniband/core/smi.h | 18 |
2 files changed, 20 insertions, 4 deletions
diff --git a/drivers/infiniband/core/mad.c b/drivers/infiniband/core/mad.c index f82900d30b9a..649335a03312 100644 --- a/drivers/infiniband/core/mad.c +++ b/drivers/infiniband/core/mad.c | |||
@@ -701,7 +701,8 @@ static int handle_outgoing_dr_smp(struct ib_mad_agent_private *mad_agent_priv, | |||
701 | } | 701 | } |
702 | 702 | ||
703 | /* Check to post send on QP or process locally */ | 703 | /* Check to post send on QP or process locally */ |
704 | if (smi_check_local_smp(smp, device) == IB_SMI_DISCARD) | 704 | if (smi_check_local_smp(smp, device) == IB_SMI_DISCARD && |
705 | smi_check_local_returning_smp(smp, device) == IB_SMI_DISCARD) | ||
705 | goto out; | 706 | goto out; |
706 | 707 | ||
707 | local = kmalloc(sizeof *local, GFP_ATOMIC); | 708 | local = kmalloc(sizeof *local, GFP_ATOMIC); |
@@ -752,8 +753,7 @@ static int handle_outgoing_dr_smp(struct ib_mad_agent_private *mad_agent_priv, | |||
752 | port_priv = ib_get_mad_port(mad_agent_priv->agent.device, | 753 | port_priv = ib_get_mad_port(mad_agent_priv->agent.device, |
753 | mad_agent_priv->agent.port_num); | 754 | mad_agent_priv->agent.port_num); |
754 | if (port_priv) { | 755 | if (port_priv) { |
755 | mad_priv->mad.mad.mad_hdr.tid = | 756 | memcpy(&mad_priv->mad.mad, smp, sizeof(struct ib_mad)); |
756 | ((struct ib_mad *)smp)->mad_hdr.tid; | ||
757 | recv_mad_agent = find_mad_agent(port_priv, | 757 | recv_mad_agent = find_mad_agent(port_priv, |
758 | &mad_priv->mad.mad); | 758 | &mad_priv->mad.mad); |
759 | } | 759 | } |
diff --git a/drivers/infiniband/core/smi.h b/drivers/infiniband/core/smi.h index 1cfc2984434f..aff96bac49b4 100644 --- a/drivers/infiniband/core/smi.h +++ b/drivers/infiniband/core/smi.h | |||
@@ -59,7 +59,8 @@ extern enum smi_action smi_handle_dr_smp_send(struct ib_smp *smp, | |||
59 | u8 node_type, int port_num); | 59 | u8 node_type, int port_num); |
60 | 60 | ||
61 | /* | 61 | /* |
62 | * Return 1 if the SMP should be handled by the local SMA/SM via process_mad | 62 | * Return IB_SMI_HANDLE if the SMP should be handled by the local SMA/SM |
63 | * via process_mad | ||
63 | */ | 64 | */ |
64 | static inline enum smi_action smi_check_local_smp(struct ib_smp *smp, | 65 | static inline enum smi_action smi_check_local_smp(struct ib_smp *smp, |
65 | struct ib_device *device) | 66 | struct ib_device *device) |
@@ -71,4 +72,19 @@ static inline enum smi_action smi_check_local_smp(struct ib_smp *smp, | |||
71 | (smp->hop_ptr == smp->hop_cnt + 1)) ? | 72 | (smp->hop_ptr == smp->hop_cnt + 1)) ? |
72 | IB_SMI_HANDLE : IB_SMI_DISCARD); | 73 | IB_SMI_HANDLE : IB_SMI_DISCARD); |
73 | } | 74 | } |
75 | |||
76 | /* | ||
77 | * Return IB_SMI_HANDLE if the SMP should be handled by the local SMA/SM | ||
78 | * via process_mad | ||
79 | */ | ||
80 | static inline enum smi_action smi_check_local_returning_smp(struct ib_smp *smp, | ||
81 | struct ib_device *device) | ||
82 | { | ||
83 | /* C14-13:3 -- We're at the end of the DR segment of path */ | ||
84 | /* C14-13:4 -- Hop Pointer == 0 -> give to SM */ | ||
85 | return ((device->process_mad && | ||
86 | ib_get_smp_direction(smp) && | ||
87 | !smp->hop_ptr) ? IB_SMI_HANDLE : IB_SMI_DISCARD); | ||
88 | } | ||
89 | |||
74 | #endif /* __SMI_H_ */ | 90 | #endif /* __SMI_H_ */ |