linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "ira.weiny" <ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
To: "Hefty, Sean" <sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Cc: "roland-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org"
	<roland-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	"linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org"
	<jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>,
	"hal-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org"
	<hal-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
Subject: Re: [PATCH v4 12/19] IB/mad: Add MAD size parameters to process_mad
Date: Wed, 8 Apr 2015 12:07:46 -0400	[thread overview]
Message-ID: <20150408160745.GE433@phlsvsds.ph.intel.com> (raw)
In-Reply-To: <1828884A29C6694DAF28B7E6B8A82373A8FBE224-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>

On Tue, Apr 07, 2015 at 11:53:00AM -0600, Hefty, Sean wrote:
> > > Rather than calling device->process_mad() directly, would it be better
> > to call a common function?  So we can avoid adding:
> > >
> > > > +	struct ib_mad *in_mad = (struct ib_mad *)in;
> > > > +	struct ib_mad *out_mad = (struct ib_mad *)out;
> > > > +
> > > > +	if (in_mad_size != sizeof(*in_mad) || *out_mad_size !=
> > > > sizeof(*out_mad))
> > > > +		return IB_MAD_RESULT_FAILURE;
> > >
> > > to existing drivers?
> > 
> > No.  The checks need to be done by the devices.  IB devices expect exactly
> > 256
> > bytes, OPA devices expect 2K, while some drivers don't care at all (don't
> > support MADs).
> 
> The checks are per device, but that doesn't mean that every driver has to do the same check.
> 
> ib_process_mad(...)
> {
> 	if (ib_device(...))
> 		insert check here
> 	else if (opa_device(...))
> 		insert some other check here
> 	else
> 		hit caller on nose

See this is another Oddity in the stack.  Those devices which are neither OPA
nor IB (iWarp or RoCE) have some support for MADs so we can't just "hit the
caller on the nose.

> 	dev->process_mad(...)
> }
> 
> I'm fine either way.  It's more a matter of how much trust is given to the other kernel components.

Indeed, I debated if I should add such checks at all.  In the end I have very
little trust so I did...  ;-)

However, to better reflect the nature of the error I've changed them all to
WARN_ONs.

Ira

--
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

  parent reply	other threads:[~2015-04-08 16:07 UTC|newest]

Thread overview: 84+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-04 23:29 [PATCH v4 00/19] IB/mad: Add support for Intel Omni-Path Architecture (OPA) MAD processing ira.weiny-ral2JQCrhuEAvxtiuMwx3w
     [not found] ` <1423092585-26692-1-git-send-email-ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-02-04 23:29   ` [PATCH v4 01/19] IB/mad: Rename is_data_mad to is_rmpp_data_mad ira.weiny-ral2JQCrhuEAvxtiuMwx3w
2015-02-04 23:29   ` [PATCH v4 02/19] IB/core: Cache device attributes for use by upper level drivers ira.weiny-ral2JQCrhuEAvxtiuMwx3w
     [not found]     ` <1423092585-26692-3-git-send-email-ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-04-03 20:43       ` Hefty, Sean
     [not found]         ` <1828884A29C6694DAF28B7E6B8A82373A8FBD574-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-04-06 22:10           ` ira.weiny
     [not found]             ` <20150406221044.GA433-W4f6Xiosr+yv7QzWx2u06xL4W9x8LtSr@public.gmane.org>
2015-04-06 22:43               ` Hefty, Sean
     [not found]                 ` <1828884A29C6694DAF28B7E6B8A82373A8FBDE3E-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-04-08 16:01                   ` ira.weiny
2015-02-04 23:29   ` [PATCH v4 03/19] IB/mad: Change validate_mad signature to take ib_mad_hdr rather than ib_mad ira.weiny-ral2JQCrhuEAvxtiuMwx3w
     [not found]     ` <1423092585-26692-4-git-send-email-ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-04-03 21:20       ` Hefty, Sean
2015-02-04 23:29   ` [PATCH v4 04/19] IB/mad: Change ib_response_mad " ira.weiny-ral2JQCrhuEAvxtiuMwx3w
     [not found]     ` <1423092585-26692-5-git-send-email-ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-04-03 21:20       ` Hefty, Sean
2015-02-04 23:29   ` [PATCH v4 05/19] IB/mad: Change cast in rcv_has_same_class ira.weiny-ral2JQCrhuEAvxtiuMwx3w
2015-02-04 23:29   ` [PATCH v4 06/19] IB/core: Add max_mad_size to ib_device_attr ira.weiny-ral2JQCrhuEAvxtiuMwx3w
     [not found]     ` <1423092585-26692-7-git-send-email-ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-02-24 14:16       ` Doug Ledford
     [not found]         ` <1424787385.4847.16.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-02-25 18:13           ` Weiny, Ira
     [not found]             ` <2807E5FD2F6FDA4886F6618EAC48510E0CC3ECE5-8k97q/ur5Z2krb+BlOpmy7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-02-25 18:23               ` Jason Gunthorpe
     [not found]                 ` <20150225182308.GA14580-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2015-02-25 18:32                   ` Weiny, Ira
     [not found]                     ` <2807E5FD2F6FDA4886F6618EAC48510E0CC3ED5B-8k97q/ur5Z2krb+BlOpmy7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-02-25 18:43                       ` Jason Gunthorpe
2015-02-04 23:29   ` [PATCH v4 07/19] IB/mad: Convert ib_mad_private allocations from kmem_cache to kmalloc ira.weiny-ral2JQCrhuEAvxtiuMwx3w
     [not found]     ` <1423092585-26692-8-git-send-email-ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-02-24 14:22       ` Doug Ledford
     [not found]         ` <1424787735.4847.19.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-02-25 18:23           ` Weiny, Ira
2015-02-04 23:29   ` [PATCH v4 08/19] IB/mad: Add helper function for smi_handle_dr_smp_send ira.weiny-ral2JQCrhuEAvxtiuMwx3w
     [not found]     ` <1423092585-26692-9-git-send-email-ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-04-03 21:28       ` Hefty, Sean
2015-02-04 23:29   ` [PATCH v4 09/19] IB/mad: Add helper function for smi_handle_dr_smp_recv ira.weiny-ral2JQCrhuEAvxtiuMwx3w
2015-02-04 23:29   ` [PATCH v4 10/19] IB/mad: Add helper function for smi_check_forward_dr_smp ira.weiny-ral2JQCrhuEAvxtiuMwx3w
2015-02-04 23:29   ` [PATCH v4 11/19] IB/mad: Add helper function for SMI processing ira.weiny-ral2JQCrhuEAvxtiuMwx3w
2015-02-04 23:29   ` [PATCH v4 12/19] IB/mad: Add MAD size parameters to process_mad ira.weiny-ral2JQCrhuEAvxtiuMwx3w
     [not found]     ` <1423092585-26692-13-git-send-email-ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-04-03 22:40       ` Hefty, Sean
     [not found]         ` <1828884A29C6694DAF28B7E6B8A82373A8FBD692-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-04-07 17:23           ` ira.weiny
     [not found]             ` <20150407172303.GB433-W4f6Xiosr+yv7QzWx2u06xL4W9x8LtSr@public.gmane.org>
2015-04-07 17:53               ` Hefty, Sean
     [not found]                 ` <1828884A29C6694DAF28B7E6B8A82373A8FBE224-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-04-08 16:07                   ` ira.weiny [this message]
2015-02-04 23:29   ` [PATCH v4 13/19] IB/mad: Add base version parameter to ib_create_send_mad ira.weiny-ral2JQCrhuEAvxtiuMwx3w
2015-02-04 23:29   ` [PATCH v4 14/19] IB/core: Add IB_DEVICE_OPA_MAD_SUPPORT device cap flag ira.weiny-ral2JQCrhuEAvxtiuMwx3w
     [not found]     ` <1423092585-26692-15-git-send-email-ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-02-06 20:35       ` Hal Rosenstock
     [not found]         ` <54D52589.8020305-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2015-02-11 15:40           ` Weiny, Ira
     [not found]             ` <2807E5FD2F6FDA4886F6618EAC48510E0CC244A8-8k97q/ur5Z2krb+BlOpmy7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-02-12 14:00               ` Hal Rosenstock
     [not found]                 ` <54DCB1E9.7010309-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2015-02-17 21:25                   ` Weiny, Ira
     [not found]                     ` <2807E5FD2F6FDA4886F6618EAC48510E0CC29020-8k97q/ur5Z2krb+BlOpmy7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-02-23 18:54                       ` Hal Rosenstock
     [not found]                         ` <54EB7756.7070407-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2015-02-25  0:29                           ` Weiny, Ira
     [not found]                             ` <2807E5FD2F6FDA4886F6618EAC48510E0CC3D330-8k97q/ur5Z2krb+BlOpmy7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-02-25 17:13                               ` Doug Ledford
     [not found]                                 ` <1424884438.4847.91.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-03-04  7:21                                   ` Weiny, Ira
     [not found]                                     ` <2807E5FD2F6FDA4886F6618EAC48510E0CC4F18C-8k97q/ur5Z2krb+BlOpmy7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-03-04 16:02                                       ` Hefty, Sean
     [not found]                                         ` <1828884A29C6694DAF28B7E6B8A8237399E6F06F-8oqHQFITsIHTXloPLtfHfbfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-03-04 16:41                                           ` Weiny, Ira
     [not found]                                             ` <2807E5FD2F6FDA4886F6618EAC48510E0CC4F50B-8k97q/ur5Z2krb+BlOpmy7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-03-09 21:22                                               ` Hal Rosenstock
     [not found]                                                 ` <54FE0F16.5090905-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2015-03-11  7:27                                                   ` Weiny, Ira
     [not found]                                                     ` <2807E5FD2F6FDA4886F6618EAC48510E0CC5C11A-8k97q/ur5Z2krb+BlOpmy7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-03-16 23:59                                                       ` Hefty, Sean
     [not found]                                                         ` <1828884A29C6694DAF28B7E6B8A8237399E8106A-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-03-17 23:36                                                           ` Hefty, Sean
     [not found]                                                             ` <1828884A29C6694DAF28B7E6B8A8237399E818C6-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-03-20 13:38                                                               ` Michael Wang
2015-03-20 13:48                                                               ` Michael Wang
     [not found]                                                                 ` <6A3D3202-0128-4F33-B596-D7A76AB66DF8@gmail.com>
     [not found]                                                                   ` <20150320235748.GA22703@phlsvsds.ph.intel.com>
     [not found]                                                                     ` <20150320235748.GA22703-W4f6Xiosr+yv7QzWx2u06xL4W9x8LtSr@public.gmane.org>
2015-03-21  0:05                                                                       ` ira.weiny
     [not found]                                                                         ` <20150321000541.GA24717-W4f6Xiosr+yv7QzWx2u06xL4W9x8LtSr@public.gmane.org>
2015-03-21  7:49                                                                           ` Yun Wang
     [not found]                                                                             ` <CAJuTgQUsZ34F-dKpsmW+5=axDWb93pA43LZ-qKbEjqyu-RUUmg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-03-23 16:31                                                                               ` Hefty, Sean
     [not found]                                                                                 ` <1828884A29C6694DAF28B7E6B8A8237399E82E58-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-03-24 12:49                                                                                   ` Michael Wang
     [not found]                                                                                     ` <55115D61.9040201-EIkl63zCoXaH+58JC4qpiA@public.gmane.org>
2015-03-25 10:30                                                                                       ` Michael Wang
     [not found]                                                                                         ` <55128E48.1080406-EIkl63zCoXaH+58JC4qpiA@public.gmane.org>
2015-04-02 22:45                                                                                           ` ira.weiny
2015-03-06 17:47                                       ` Jason Gunthorpe
     [not found]                                         ` <20150306174729.GE22375-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2015-03-06 22:47                                           ` Weiny, Ira
     [not found]                                             ` <2807E5FD2F6FDA4886F6618EAC48510E0CC53437-8k97q/ur5Z2krb+BlOpmy7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-03-09 21:23                                               ` Hal Rosenstock
2015-02-04 23:29   ` [PATCH v4 15/19] IB/mad: Create jumbo_mad data structures ira.weiny-ral2JQCrhuEAvxtiuMwx3w
     [not found]     ` <1423092585-26692-16-git-send-email-ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-04-03 23:08       ` Hefty, Sean
     [not found]         ` <1828884A29C6694DAF28B7E6B8A82373A8FBD6C8-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-04-04  0:14           ` Hefty, Sean
2015-04-08 15:33           ` ira.weiny
2015-02-04 23:29   ` [PATCH v4 16/19] IB/mad: Add Intel Omni-Path Architecture defines ira.weiny-ral2JQCrhuEAvxtiuMwx3w
     [not found]     ` <1423092585-26692-17-git-send-email-ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-04-03 23:33       ` Hefty, Sean
     [not found]         ` <1828884A29C6694DAF28B7E6B8A82373A8FBD708-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-04-08 21:41           ` ira.weiny
2015-02-04 23:29   ` [PATCH v4 17/19] IB/mad: Implement support for Intel Omni-Path Architecture base version MADs in ib_create_send_mad ira.weiny-ral2JQCrhuEAvxtiuMwx3w
     [not found]     ` <1423092585-26692-18-git-send-email-ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-04-03 23:40       ` Hefty, Sean
     [not found]         ` <1828884A29C6694DAF28B7E6B8A82373A8FBD722-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-04-08 21:36           ` ira.weiny
     [not found]             ` <20150408213612.GG433-W4f6Xiosr+yv7QzWx2u06xL4W9x8LtSr@public.gmane.org>
2015-04-08 21:44               ` Hefty, Sean
2015-02-04 23:29   ` [PATCH v4 18/19] IB/mad: Implement Intel Omni-Path Architecture SMP processing ira.weiny-ral2JQCrhuEAvxtiuMwx3w
     [not found]     ` <1423092585-26692-19-git-send-email-ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-04-03 23:47       ` Hefty, Sean
     [not found]         ` <1828884A29C6694DAF28B7E6B8A82373A8FBD742-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-04-09  4:41           ` ira.weiny
2015-02-04 23:29   ` [PATCH v4 19/19] IB/mad: Implement Intel Omni-Path Architecture MAD processing ira.weiny-ral2JQCrhuEAvxtiuMwx3w
     [not found]     ` <1423092585-26692-20-git-send-email-ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-04-04  1:44       ` Hefty, Sean
     [not found]         ` <1828884A29C6694DAF28B7E6B8A82373A8FBD9DE-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-04-07  2:29           ` Jason Gunthorpe
     [not found]             ` <20150407022954.GA7531-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2015-04-07 16:57               ` Hefty, Sean
     [not found]                 ` <1828884A29C6694DAF28B7E6B8A82373A8FBE150-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-04-07 17:16                   ` Jason Gunthorpe
     [not found]                     ` <20150407171659.GA15634-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2015-04-07 17:41                       ` Hefty, Sean
     [not found]                         ` <1828884A29C6694DAF28B7E6B8A82373A8FBE1EB-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-04-07 18:06                           ` Jason Gunthorpe
2015-04-07 17:15             ` Hefty, Sean
     [not found]               ` <1828884A29C6694DAF28B7E6B8A82373A8FBE17D-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-04-07 17:19                 ` Jason Gunthorpe
     [not found]                   ` <20150407171920.GB15634-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2015-04-08 21:24                     ` ira.weiny
2015-02-06 20:34   ` [PATCH v4 00/19] IB/mad: Add support for Intel Omni-Path Architecture (OPA) " Hal Rosenstock
     [not found]     ` <54D52562.5050408-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2015-02-09 21:20       ` 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=20150408160745.GE433@phlsvsds.ph.intel.com \
    --to=ira.weiny-ral2jqcrhueavxtiumwx3w@public.gmane.org \
    --cc=hal-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org \
    --cc=jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=roland-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=sean.hefty-ral2JQCrhuEAvxtiuMwx3w@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;
as well as URLs for NNTP newsgroup(s).