From: ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org
To: roland-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Ira Weiny <ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Subject: [RFC PATCH 13/16] ib/mad: create helper function for smi_check_forward_dr_smp
Date: Thu, 13 Nov 2014 14:54:22 -0500 [thread overview]
Message-ID: <1415908465-24392-14-git-send-email-ira.weiny@intel.com> (raw)
In-Reply-To: <1415908465-24392-1-git-send-email-ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
From: Ira Weiny <ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
This helper function will be used for processing both IB and OPA SMPs.
Signed-off-by: Ira Weiny <ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
drivers/infiniband/core/smi.c | 26 +++++++++++++++++---------
1 file changed, 17 insertions(+), 9 deletions(-)
diff --git a/drivers/infiniband/core/smi.c b/drivers/infiniband/core/smi.c
index 24670de..8a5fb1d 100644
--- a/drivers/infiniband/core/smi.c
+++ b/drivers/infiniband/core/smi.c
@@ -236,21 +236,20 @@ enum smi_action smi_handle_dr_smp_recv(struct ib_smp *smp, u8 node_type,
smp->dr_slid == IB_LID_PERMISSIVE);
}
-enum smi_forward_action smi_check_forward_dr_smp(struct ib_smp *smp)
+static inline
+enum smi_forward_action __smi_check_forward_dr_smp(u8 hop_ptr, u8 hop_cnt,
+ u8 direction,
+ int dr_dlid_is_permissive,
+ int dr_slid_is_permissive)
{
- u8 hop_ptr, hop_cnt;
-
- hop_ptr = smp->hop_ptr;
- hop_cnt = smp->hop_cnt;
-
- if (!ib_get_smp_direction(smp)) {
+ if (!direction) {
/* C14-9:2 -- intermediate hop */
if (hop_ptr && hop_ptr < hop_cnt)
return IB_SMI_FORWARD;
/* C14-9:3 -- at the end of the DR segment of path */
if (hop_ptr == hop_cnt)
- return (smp->dr_dlid == IB_LID_PERMISSIVE ?
+ return (dr_dlid_is_permissive ?
IB_SMI_SEND : IB_SMI_LOCAL);
/* C14-9:4 -- hop_ptr = hop_cnt + 1 -> give to SMA/SM */
@@ -263,10 +262,19 @@ enum smi_forward_action smi_check_forward_dr_smp(struct ib_smp *smp)
/* C14-13:3 -- at the end of the DR segment of path */
if (hop_ptr == 1)
- return (smp->dr_slid != IB_LID_PERMISSIVE ?
+ return (dr_slid_is_permissive ?
IB_SMI_SEND : IB_SMI_LOCAL);
}
return IB_SMI_LOCAL;
+
+}
+
+enum smi_forward_action smi_check_forward_dr_smp(struct ib_smp *smp)
+{
+ return __smi_check_forward_dr_smp(smp->hop_ptr, smp->hop_cnt,
+ ib_get_smp_direction(smp),
+ smp->dr_dlid == IB_LID_PERMISSIVE,
+ smp->dr_slid != IB_LID_PERMISSIVE);
}
/*
--
1.8.2
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2014-11-13 19:54 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-13 19:54 [RFC PATCH 00/16] ib_mad: Add support for Intel Omni-Path Architecture (OPA) MAD processing ira.weiny-ral2JQCrhuEAvxtiuMwx3w
[not found] ` <1415908465-24392-1-git-send-email-ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-11-13 19:54 ` [RFC PATCH 01/16] ib/mad: rename is_data_mad to is_rmpp_data_mad ira.weiny-ral2JQCrhuEAvxtiuMwx3w
2014-11-13 19:54 ` [RFC PATCH 02/16] ib/core: add IB_DEVICE_JUMBO_MAD_SUPPORT device cap flag ira.weiny-ral2JQCrhuEAvxtiuMwx3w
2014-11-13 19:54 ` [RFC PATCH 03/16] ib/mad: Add check for jumbo MADs support on a device ira.weiny-ral2JQCrhuEAvxtiuMwx3w
[not found] ` <1415908465-24392-4-git-send-email-ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-11-27 11:47 ` Or Gerlitz
[not found] ` <54770F44.2090909-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2014-11-27 13:51 ` Sagi Grimberg
[not found] ` <54772C70.8060602-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2014-11-27 14:59 ` Or Gerlitz
[not found] ` <54773C59.6080505-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2015-01-07 16:32 ` Weiny, Ira
[not found] ` <2807E5FD2F6FDA4886F6618EAC48510E0CBEE86E-8k97q/ur5Z2krb+BlOpmy7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-01-08 11:41 ` Or Gerlitz
2014-12-08 0:23 ` Weiny, Ira
[not found] ` <2807E5FD2F6FDA4886F6618EAC48510E0CBD4F23-8k97q/ur5Z2krb+BlOpmy7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
2014-12-08 0:47 ` Roland Dreier
[not found] ` <CAG4TOxNt+0p+i1a6oN1xx+K_OZEuZhPJ5e=44KScnaGVA4E0SA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-12-09 23:23 ` Weiny, Ira
2014-12-08 11:29 ` Or Gerlitz
[not found] ` <CAJ3xEMj-0_0F+VoGZDes92ShFRTbt9Et4WWPt=viY5gx_P-oNg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-12-09 22:36 ` Weiny, Ira
[not found] ` <2807E5FD2F6FDA4886F6618EAC48510E0CBD7A97-8k97q/ur5Z2krb+BlOpmy7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
2014-12-10 7:52 ` Or Gerlitz
2014-11-13 19:54 ` [RFC PATCH 04/16] ib/mad: add base version parameter to ib_create_send_mad ira.weiny-ral2JQCrhuEAvxtiuMwx3w
2014-11-13 19:54 ` [RFC PATCH 05/16] ib/mad: Add MAD size parameters to process_mad ira.weiny-ral2JQCrhuEAvxtiuMwx3w
2014-11-13 19:54 ` [RFC PATCH 06/16] ib/mad: Create jumbo_mad data structures ira.weiny-ral2JQCrhuEAvxtiuMwx3w
2014-11-13 19:54 ` [RFC PATCH 07/16] ib/mad: create a jumbo MAD kmem_cache ira.weiny-ral2JQCrhuEAvxtiuMwx3w
[not found] ` <1415908465-24392-8-git-send-email-ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-11-27 11:50 ` Or Gerlitz
[not found] ` <54770FF4.3070807-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2014-12-05 21:25 ` Weiny, Ira
2014-11-13 19:54 ` [RFC PATCH 08/16] ib/mad: Add Intel Omni-Path Architecture defines ira.weiny-ral2JQCrhuEAvxtiuMwx3w
2014-11-13 19:54 ` [RFC PATCH 09/16] ib/mad: Implement support for Intel Omni-Path Architecture base version MADs in ib_create_send_mad ira.weiny-ral2JQCrhuEAvxtiuMwx3w
2014-11-13 19:54 ` [RFC PATCH 10/16] ib/mad: Add registration check for Intel Omni-Path Architecture MADs ira.weiny-ral2JQCrhuEAvxtiuMwx3w
2014-11-13 19:54 ` [RFC PATCH 11/16] ib/mad: create helper function for smi_handle_dr_smp_send ira.weiny-ral2JQCrhuEAvxtiuMwx3w
2014-11-13 19:54 ` [RFC PATCH 12/16] ib/mad: create helper function for smi_handle_dr_smp_recv ira.weiny-ral2JQCrhuEAvxtiuMwx3w
2014-11-13 19:54 ` ira.weiny-ral2JQCrhuEAvxtiuMwx3w [this message]
2014-11-13 19:54 ` [RFC PATCH 14/16] ib/mad: Create helper function for SMI processing ira.weiny-ral2JQCrhuEAvxtiuMwx3w
2014-11-13 19:54 ` [RFC PATCH 15/16] ib/mad: Implement Intel Omni-Path Architecture SMP processing ira.weiny-ral2JQCrhuEAvxtiuMwx3w
2014-11-13 19:54 ` [RFC PATCH 16/16] ib/mad: Implement Intel Omni-Path Architecture General MAD processing ira.weiny-ral2JQCrhuEAvxtiuMwx3w
2014-11-18 22:16 ` [RFC PATCH 00/16] ib_mad: Add support for Intel Omni-Path Architecture (OPA) " Or Gerlitz
[not found] ` <CAJ3xEMhtm99dRdcEvhK9s961mDr7YSU3pkv-WK=sESKe_K4kYw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-11-25 21:52 ` Weiny, Ira
[not found] ` <2807E5FD2F6FDA4886F6618EAC48510E0CBC6B23-8k97q/ur5Z2krb+BlOpmy7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
2014-11-27 10:02 ` Or Gerlitz
[not found] ` <5476F6BB.1020200-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2014-12-01 22:18 ` Weiny, Ira
2014-11-25 23:16 ` Hal Rosenstock
[not found] ` <54750DCF.90308-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2014-12-01 22:33 ` Weiny, Ira
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1415908465-24392-14-git-send-email-ira.weiny@intel.com \
--to=ira.weiny-ral2jqcrhueavxtiumwx3w@public.gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=roland-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox