Skip to content

Commit 24b440a

Browse files
Dag MoxnesMukesh Kacker
authored andcommitted
ib_mad: incoming sminfo SMPs gets discarded if no process_mad function is registered
The process_mad function is an optional IB driver entry point allows a driver to intercept or modify MAD traffic. This fix allows MAD traffic to flow down to the device also when MAD traffic is completely handled by the device and no process_mad function is provided. Orabug: 20930262 Signed-off-by: Knut Omang <[email protected]> Signed-off-by: Mukesh Kacker <[email protected]>
1 parent 8576516 commit 24b440a

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

drivers/infiniband/core/mad.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -762,6 +762,9 @@ static int handle_outgoing_dr_smp(struct ib_mad_agent_private *mad_agent_priv,
762762
goto out;
763763
}
764764

765+
if (!device->process_mad)
766+
goto out;
767+
765768
/* Check to post send on QP or process locally */
766769
if (smi_check_local_smp(smp, device) == IB_SMI_DISCARD &&
767770
smi_check_local_returning_smp(smp, device) == IB_SMI_DISCARD)

drivers/infiniband/core/smi.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,7 @@ static inline enum smi_action smi_check_local_smp(struct ib_smp *smp,
6767
{
6868
/* C14-9:3 -- We're at the end of the DR segment of path */
6969
/* C14-9:4 -- Hop Pointer = Hop Count + 1 -> give to SMA/SM */
70-
return ((device->process_mad &&
71-
!ib_get_smp_direction(smp) &&
70+
return ((!ib_get_smp_direction(smp) &&
7271
(smp->hop_ptr == smp->hop_cnt + 1)) ?
7372
IB_SMI_HANDLE : IB_SMI_DISCARD);
7473
}
@@ -82,8 +81,7 @@ static inline enum smi_action smi_check_local_returning_smp(struct ib_smp *smp,
8281
{
8382
/* C14-13:3 -- We're at the end of the DR segment of path */
8483
/* C14-13:4 -- Hop Pointer == 0 -> give to SM */
85-
return ((device->process_mad &&
86-
ib_get_smp_direction(smp) &&
84+
return ((ib_get_smp_direction(smp) &&
8785
!smp->hop_ptr) ? IB_SMI_HANDLE : IB_SMI_DISCARD);
8886
}
8987

0 commit comments

Comments
 (0)