Re: [PATCH v5 01/27] IB/Verbs: Implement new callback query_transport()

2015-04-23 Thread Michael Wang


On 04/22/2015 05:02 PM, Doug Ledford wrote:
> On Mon, 2015-04-20 at 10:32 +0200, Michael Wang wrote:
>> Add new callback query_transport() and implement for each HW.
> 
> The more I think about it, the more I think we need to eliminate this
> patch entirely.
> 
> The problem here is that, if we follow my suggestion, then we are going
> to eliminate the query as an API function and replace the information it
> gives us with a static port attribute bitmap.  If we do this patch, then
> reform this patch to my idea later, we introduce a very short lived
> API/ABI change in the kernel module interface that serves absolutely no
> purpose.  Instead, let's do the bitmap creation first, update the
> drivers to properly set the bitmap, then do all of the remaining reforms
> you have here using that bitmap and completely skip the
> query_transport() API item that will no longer serve a purpose.

I really prefer to see the bitmask mechanism come along with the bits
defined, at least we are not going to use transport anymore, correct?

I think there will be more discussion on bitmask stuff, not only about
the definition of each bit, but also the timing to initialize it (should
before each HW register the device).

That's really a different topic which we can't settle down within few
versions IMHO, and I really like to staging our progress at this moment.

With these foundation, it would be really easy to expanding the topic
further and let more folks join at the beginning, but if we introduce
bitmask at this moments, the topic will be mixed with different purpose
and become confusion...

We can do whatever the reform/discussion in next series, the topic would
be clean and clear ;-)

Regards,
Michael Wang

> 
>> Mapping List:
>>  node-type   link-layer  old-transport   new-transport
>> nes  RNICETH IWARP   IWARP
>> amso1100 RNICETH IWARP   IWARP
>> cxgb3RNICETH IWARP   IWARP
>> cxgb4RNICETH IWARP   IWARP
>> usnicUSNIC_UDP   ETH USNIC_UDP   USNIC_UDP
>> ocrdma   IB_CA   ETH IB  IBOE
>> mlx4 IB_CA   IB/ETH  IB  IB/IBOE
>> mlx5 IB_CA   IB  IB  IB
>> ehca IB_CA   IB  IB  IB
>> ipathIB_CA   IB  IB  IB
>> mthcaIB_CA   IB  IB  IB
>> qib  IB_CA   IB  IB  IB
>>
>> Cc: Hal Rosenstock 
>> Cc: Steve Wise 
>> Cc: Tom Talpey 
>> Cc: Jason Gunthorpe 
>> Cc: Doug Ledford 
>> Cc: Ira Weiny 
>> Cc: Sean Hefty 
>> Signed-off-by: Michael Wang 
>> ---
>>  drivers/infiniband/core/device.c |  1 +
>>  drivers/infiniband/core/verbs.c  |  4 +++-
>>  drivers/infiniband/hw/amso1100/c2_provider.c |  7 +++
>>  drivers/infiniband/hw/cxgb3/iwch_provider.c  |  7 +++
>>  drivers/infiniband/hw/cxgb4/provider.c   |  7 +++
>>  drivers/infiniband/hw/ehca/ehca_hca.c|  6 ++
>>  drivers/infiniband/hw/ehca/ehca_iverbs.h |  3 +++
>>  drivers/infiniband/hw/ehca/ehca_main.c   |  1 +
>>  drivers/infiniband/hw/ipath/ipath_verbs.c|  7 +++
>>  drivers/infiniband/hw/mlx4/main.c| 10 ++
>>  drivers/infiniband/hw/mlx5/main.c|  7 +++
>>  drivers/infiniband/hw/mthca/mthca_provider.c |  7 +++
>>  drivers/infiniband/hw/nes/nes_verbs.c|  6 ++
>>  drivers/infiniband/hw/ocrdma/ocrdma_main.c   |  1 +
>>  drivers/infiniband/hw/ocrdma/ocrdma_verbs.c  |  6 ++
>>  drivers/infiniband/hw/ocrdma/ocrdma_verbs.h  |  3 +++
>>  drivers/infiniband/hw/qib/qib_verbs.c|  7 +++
>>  drivers/infiniband/hw/usnic/usnic_ib_main.c  |  1 +
>>  drivers/infiniband/hw/usnic/usnic_ib_verbs.c |  6 ++
>>  drivers/infiniband/hw/usnic/usnic_ib_verbs.h |  2 ++
>>  include/rdma/ib_verbs.h  |  7 ++-
>>  21 files changed, 104 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/infiniband/core/device.c 
>> b/drivers/infiniband/core/device.c
>> index 18c1ece..a9587c4 100644
>> --- a/drivers/infiniband/core/device.c
>> +++ b/drivers/infiniband/core/device.c
>> @@ -76,6 +76,7 @@ static int ib_device_check_mandatory(struct ib_device 
>> *device)
>>  } mandatory_table[] = {
>>  IB_MANDATORY_FUNC(query_device),
>>  IB_MANDATORY_FUNC(query_port),
>> +IB_MANDATORY_FUNC(query_transport),
>>  IB_MANDATORY_FUNC(query_pkey),
>>  IB_MANDATORY_FUNC(query_gid),
>>  IB_MANDATORY_FUNC(alloc_pd),
>> diff --git a/drivers/infiniband/core/verbs.c 
>> b/drivers/infiniband/core/verbs.c
>> index f93eb8d..626c9cf 100644
>> --- a/drivers/infiniband/core/verbs.c
>> +++ b/drivers/infiniband/core/verbs.c
>> @@ -133,14 +133,16 @@ enum 

Re: [PATCH v5 01/27] IB/Verbs: Implement new callback query_transport()

2015-04-23 Thread Michael Wang


On 04/22/2015 05:02 PM, Doug Ledford wrote:
 On Mon, 2015-04-20 at 10:32 +0200, Michael Wang wrote:
 Add new callback query_transport() and implement for each HW.
 
 The more I think about it, the more I think we need to eliminate this
 patch entirely.
 
 The problem here is that, if we follow my suggestion, then we are going
 to eliminate the query as an API function and replace the information it
 gives us with a static port attribute bitmap.  If we do this patch, then
 reform this patch to my idea later, we introduce a very short lived
 API/ABI change in the kernel module interface that serves absolutely no
 purpose.  Instead, let's do the bitmap creation first, update the
 drivers to properly set the bitmap, then do all of the remaining reforms
 you have here using that bitmap and completely skip the
 query_transport() API item that will no longer serve a purpose.

I really prefer to see the bitmask mechanism come along with the bits
defined, at least we are not going to use transport anymore, correct?

I think there will be more discussion on bitmask stuff, not only about
the definition of each bit, but also the timing to initialize it (should
before each HW register the device).

That's really a different topic which we can't settle down within few
versions IMHO, and I really like to staging our progress at this moment.

With these foundation, it would be really easy to expanding the topic
further and let more folks join at the beginning, but if we introduce
bitmask at this moments, the topic will be mixed with different purpose
and become confusion...

We can do whatever the reform/discussion in next series, the topic would
be clean and clear ;-)

Regards,
Michael Wang

 
 Mapping List:
  node-type   link-layer  old-transport   new-transport
 nes  RNICETH IWARP   IWARP
 amso1100 RNICETH IWARP   IWARP
 cxgb3RNICETH IWARP   IWARP
 cxgb4RNICETH IWARP   IWARP
 usnicUSNIC_UDP   ETH USNIC_UDP   USNIC_UDP
 ocrdma   IB_CA   ETH IB  IBOE
 mlx4 IB_CA   IB/ETH  IB  IB/IBOE
 mlx5 IB_CA   IB  IB  IB
 ehca IB_CA   IB  IB  IB
 ipathIB_CA   IB  IB  IB
 mthcaIB_CA   IB  IB  IB
 qib  IB_CA   IB  IB  IB

 Cc: Hal Rosenstock h...@dev.mellanox.co.il
 Cc: Steve Wise sw...@opengridcomputing.com
 Cc: Tom Talpey t...@talpey.com
 Cc: Jason Gunthorpe jguntho...@obsidianresearch.com
 Cc: Doug Ledford dledf...@redhat.com
 Cc: Ira Weiny ira.we...@intel.com
 Cc: Sean Hefty sean.he...@intel.com
 Signed-off-by: Michael Wang yun.w...@profitbricks.com
 ---
  drivers/infiniband/core/device.c |  1 +
  drivers/infiniband/core/verbs.c  |  4 +++-
  drivers/infiniband/hw/amso1100/c2_provider.c |  7 +++
  drivers/infiniband/hw/cxgb3/iwch_provider.c  |  7 +++
  drivers/infiniband/hw/cxgb4/provider.c   |  7 +++
  drivers/infiniband/hw/ehca/ehca_hca.c|  6 ++
  drivers/infiniband/hw/ehca/ehca_iverbs.h |  3 +++
  drivers/infiniband/hw/ehca/ehca_main.c   |  1 +
  drivers/infiniband/hw/ipath/ipath_verbs.c|  7 +++
  drivers/infiniband/hw/mlx4/main.c| 10 ++
  drivers/infiniband/hw/mlx5/main.c|  7 +++
  drivers/infiniband/hw/mthca/mthca_provider.c |  7 +++
  drivers/infiniband/hw/nes/nes_verbs.c|  6 ++
  drivers/infiniband/hw/ocrdma/ocrdma_main.c   |  1 +
  drivers/infiniband/hw/ocrdma/ocrdma_verbs.c  |  6 ++
  drivers/infiniband/hw/ocrdma/ocrdma_verbs.h  |  3 +++
  drivers/infiniband/hw/qib/qib_verbs.c|  7 +++
  drivers/infiniband/hw/usnic/usnic_ib_main.c  |  1 +
  drivers/infiniband/hw/usnic/usnic_ib_verbs.c |  6 ++
  drivers/infiniband/hw/usnic/usnic_ib_verbs.h |  2 ++
  include/rdma/ib_verbs.h  |  7 ++-
  21 files changed, 104 insertions(+), 2 deletions(-)

 diff --git a/drivers/infiniband/core/device.c 
 b/drivers/infiniband/core/device.c
 index 18c1ece..a9587c4 100644
 --- a/drivers/infiniband/core/device.c
 +++ b/drivers/infiniband/core/device.c
 @@ -76,6 +76,7 @@ static int ib_device_check_mandatory(struct ib_device 
 *device)
  } mandatory_table[] = {
  IB_MANDATORY_FUNC(query_device),
  IB_MANDATORY_FUNC(query_port),
 +IB_MANDATORY_FUNC(query_transport),
  IB_MANDATORY_FUNC(query_pkey),
  IB_MANDATORY_FUNC(query_gid),
  IB_MANDATORY_FUNC(alloc_pd),
 diff --git a/drivers/infiniband/core/verbs.c 
 b/drivers/infiniband/core/verbs.c
 index f93eb8d..626c9cf 100644
 --- a/drivers/infiniband/core/verbs.c
 +++ b/drivers/infiniband/core/verbs.c

Re: [PATCH v5 01/27] IB/Verbs: Implement new callback query_transport()

2015-04-22 Thread Doug Ledford
On Wed, 2015-04-22 at 15:21 +, Devesh Sharma wrote:
> > -Original Message-
> > From: linux-rdma-ow...@vger.kernel.org [mailto:linux-rdma-
> > ow...@vger.kernel.org] On Behalf Of Doug Ledford
> > Sent: Wednesday, April 22, 2015 8:33 PM
> > To: Michael Wang
> > Cc: Roland Dreier; Sean Hefty; linux-r...@vger.kernel.org; linux-
> > ker...@vger.kernel.org; h...@dev.mellanox.co.il; Tom Tucker; Steve Wise;
> > Hoang-Nam Nguyen; Christoph Raisch; Mike Marciniszyn; Eli Cohen; Faisal
> > Latif; Jack Morgenstein; Or Gerlitz; Haggai Eran; Ira Weiny; Tom Talpey; 
> > Jason
> > Gunthorpe
> > Subject: Re: [PATCH v5 01/27] IB/Verbs: Implement new callback
> > query_transport()
> > 
> > On Mon, 2015-04-20 at 10:32 +0200, Michael Wang wrote:
> > > Add new callback query_transport() and implement for each HW.
> > 
> > The more I think about it, the more I think we need to eliminate this patch
> > entirely.
> > 
> > The problem here is that, if we follow my suggestion, then we are going to
> > eliminate the query as an API function and replace the information it gives 
> > us
> > with a static port attribute bitmap.  If we do this patch, then reform this 
> > patch
> > to my idea later, we introduce a very short lived API/ABI change in the 
> > kernel
> > module interface that serves absolutely no purpose.  Instead, let's do the
> > bitmap creation first, update the drivers to properly set the bitmap, then 
> > do all
> > of the remaining reforms you have here using that bitmap and completely skip
> > the
> > query_transport() API item that will no longer serve a purpose.
> 
> Any vendor device that registers with IB stack already has capability flags, 
> are you referring to the same as bit maps?
> Is it possible to use same as bitmaps you are referring to? I am trying to 
> understand you complete idea.

There are two capability flags right now, a device caps flag set and a
port caps flag set (not counting possible driver internal flags).
Regardless of whether or not we wanted to use one or the other, they are
both too full to be used for our purposes.  We can't get enough bits.
We would get to drop the node_type, but that's only a u8 and so it
doesn't have enough bits either.  In addition, node_type is set per
device, and it would really be best if our new bitmap were per port.

That then raises the issue that right now, the core code doesn't have
direct access to per-port information, everything is done via a
combination of direct access to the per device node check and per port
driver callbacks.  We may have no choice but to continue with that for
now, but I find that inefficient.  And if we make the bitmap per port,
then even our node check becomes a callback.

So, what we need to do, is define a specific bitmap just for the
node/transport/link bits and the capability bits that explicitly go with
that tuple *and* define a way to access it without necessarily requiring
a callback.

Michael's patch set has gone through a lot of revisions and I think we
are getting close to the set of things we want to know, so it shouldn't
be that hard now to create the proper bitmap that makes knowing those
things quick and efficient.

The harder part will be making it accessible.  Since the current struct
ib_device doesn't include direct access to the ports (it has a list head
for port_list, but that's just for the sysfs entries for this device, it
doesn't hold anything we can use for this) we are limited to either A)
adding a new callback or B) changing node_type to port_type, making it a
larger size, and making it a port indexed array.

-- 
Doug Ledford 
  GPG KeyID: 0E572FDD




signature.asc
Description: This is a digitally signed message part


Re: [PATCH v5 01/27] IB/Verbs: Implement new callback query_transport()

2015-04-22 Thread ira.weiny
On Wed, Apr 22, 2015 at 03:21:43PM +, Devesh Sharma wrote:
> > -Original Message-
> > From: linux-rdma-ow...@vger.kernel.org [mailto:linux-rdma-
> > ow...@vger.kernel.org] On Behalf Of Doug Ledford
> > Sent: Wednesday, April 22, 2015 8:33 PM
> > To: Michael Wang
> > Cc: Roland Dreier; Sean Hefty; linux-r...@vger.kernel.org; linux-
> > ker...@vger.kernel.org; h...@dev.mellanox.co.il; Tom Tucker; Steve Wise;
> > Hoang-Nam Nguyen; Christoph Raisch; Mike Marciniszyn; Eli Cohen; Faisal
> > Latif; Jack Morgenstein; Or Gerlitz; Haggai Eran; Ira Weiny; Tom Talpey; 
> > Jason
> > Gunthorpe
> > Subject: Re: [PATCH v5 01/27] IB/Verbs: Implement new callback
> > query_transport()
> > 
> > On Mon, 2015-04-20 at 10:32 +0200, Michael Wang wrote:
> > > Add new callback query_transport() and implement for each HW.
> > 
> > The more I think about it, the more I think we need to eliminate this patch
> > entirely.
> > 
> > The problem here is that, if we follow my suggestion, then we are going to
> > eliminate the query as an API function and replace the information it gives 
> > us
> > with a static port attribute bitmap.  If we do this patch, then reform this 
> > patch
> > to my idea later, we introduce a very short lived API/ABI change in the 
> > kernel
> > module interface that serves absolutely no purpose.  Instead, let's do the
> > bitmap creation first, update the drivers to properly set the bitmap, then 
> > do all
> > of the remaining reforms you have here using that bitmap and completely skip
> > the
> > query_transport() API item that will no longer serve a purpose.
> 
> Any vendor device that registers with IB stack already has capability flags, 
> are you referring to the same as bit maps?
> Is it possible to use same as bitmaps you are referring to? I am trying to 
> understand you complete idea.

The idea was to use additional bit maps.

https://www.mail-archive.com/linux-rdma@vger.kernel.org/msg23765.html

Ira

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


RE: [PATCH v5 01/27] IB/Verbs: Implement new callback query_transport()

2015-04-22 Thread Devesh Sharma
> -Original Message-
> From: linux-rdma-ow...@vger.kernel.org [mailto:linux-rdma-
> ow...@vger.kernel.org] On Behalf Of Doug Ledford
> Sent: Wednesday, April 22, 2015 8:33 PM
> To: Michael Wang
> Cc: Roland Dreier; Sean Hefty; linux-r...@vger.kernel.org; linux-
> ker...@vger.kernel.org; h...@dev.mellanox.co.il; Tom Tucker; Steve Wise;
> Hoang-Nam Nguyen; Christoph Raisch; Mike Marciniszyn; Eli Cohen; Faisal
> Latif; Jack Morgenstein; Or Gerlitz; Haggai Eran; Ira Weiny; Tom Talpey; Jason
> Gunthorpe
> Subject: Re: [PATCH v5 01/27] IB/Verbs: Implement new callback
> query_transport()
> 
> On Mon, 2015-04-20 at 10:32 +0200, Michael Wang wrote:
> > Add new callback query_transport() and implement for each HW.
> 
> The more I think about it, the more I think we need to eliminate this patch
> entirely.
> 
> The problem here is that, if we follow my suggestion, then we are going to
> eliminate the query as an API function and replace the information it gives us
> with a static port attribute bitmap.  If we do this patch, then reform this 
> patch
> to my idea later, we introduce a very short lived API/ABI change in the kernel
> module interface that serves absolutely no purpose.  Instead, let's do the
> bitmap creation first, update the drivers to properly set the bitmap, then do 
> all
> of the remaining reforms you have here using that bitmap and completely skip
> the
> query_transport() API item that will no longer serve a purpose.

Any vendor device that registers with IB stack already has capability flags, 
are you referring to the same as bit maps?
Is it possible to use same as bitmaps you are referring to? I am trying to 
understand you complete idea.

> 
> > Mapping List:
> > node-type   link-layer  old-transport   new-transport
> > nes RNICETH IWARP   IWARP
> > amso1100RNICETH IWARP   IWARP
> > cxgb3   RNICETH IWARP   IWARP
> > cxgb4   RNICETH IWARP   IWARP
> > usnic   USNIC_UDP   ETH USNIC_UDP   USNIC_UDP
> > ocrdma  IB_CA   ETH IB  IBOE
> > mlx4IB_CA   IB/ETH  IB  IB/IBOE
> > mlx5IB_CA   IB  IB  IB
> > ehcaIB_CA   IB  IB  IB
> > ipath   IB_CA   IB  IB  IB
> > mthca   IB_CA   IB  IB  IB
> > qib IB_CA   IB  IB  IB
> >
> > Cc: Hal Rosenstock 
> > Cc: Steve Wise 
> > Cc: Tom Talpey 
> > Cc: Jason Gunthorpe 
> > Cc: Doug Ledford 
> > Cc: Ira Weiny 
> > Cc: Sean Hefty 
> > Signed-off-by: Michael Wang 
> > ---
> >  drivers/infiniband/core/device.c |  1 +
> >  drivers/infiniband/core/verbs.c  |  4 +++-
> >  drivers/infiniband/hw/amso1100/c2_provider.c |  7 +++
> > drivers/infiniband/hw/cxgb3/iwch_provider.c  |  7 +++
> >  drivers/infiniband/hw/cxgb4/provider.c   |  7 +++
> >  drivers/infiniband/hw/ehca/ehca_hca.c|  6 ++
> >  drivers/infiniband/hw/ehca/ehca_iverbs.h |  3 +++
> >  drivers/infiniband/hw/ehca/ehca_main.c   |  1 +
> >  drivers/infiniband/hw/ipath/ipath_verbs.c|  7 +++
> >  drivers/infiniband/hw/mlx4/main.c| 10 ++
> >  drivers/infiniband/hw/mlx5/main.c|  7 +++
> >  drivers/infiniband/hw/mthca/mthca_provider.c |  7 +++
> >  drivers/infiniband/hw/nes/nes_verbs.c|  6 ++
> >  drivers/infiniband/hw/ocrdma/ocrdma_main.c   |  1 +
> >  drivers/infiniband/hw/ocrdma/ocrdma_verbs.c  |  6 ++
> > drivers/infiniband/hw/ocrdma/ocrdma_verbs.h  |  3 +++
> >  drivers/infiniband/hw/qib/qib_verbs.c|  7 +++
> >  drivers/infiniband/hw/usnic/usnic_ib_main.c  |  1 +
> > drivers/infiniband/hw/usnic/usnic_ib_verbs.c |  6 ++
> > drivers/infiniband/hw/usnic/usnic_ib_verbs.h |  2 ++
> >  include/rdma/ib_verbs.h  |  7 ++-
> >  21 files changed, 104 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/infiniband/core/device.c
> > b/drivers/infiniband/core/device.c
> > index 18c1ece..a9587c4 100644
> > --- a/drivers/infiniband/core/device.c
> > +++ b/drivers/infiniband/core/device.c
> > @@ -76,6 +76,7 @@ static int ib_device_check_mandatory(struct ib_device
> *device)
> > } mandatory_table[] = {
> > IB_MANDATORY_FUNC(query_device),
> > IB_MANDATORY_FUNC

Re: [PATCH v5 01/27] IB/Verbs: Implement new callback query_transport()

2015-04-22 Thread Doug Ledford
On Mon, 2015-04-20 at 10:32 +0200, Michael Wang wrote:
> Add new callback query_transport() and implement for each HW.

The more I think about it, the more I think we need to eliminate this
patch entirely.

The problem here is that, if we follow my suggestion, then we are going
to eliminate the query as an API function and replace the information it
gives us with a static port attribute bitmap.  If we do this patch, then
reform this patch to my idea later, we introduce a very short lived
API/ABI change in the kernel module interface that serves absolutely no
purpose.  Instead, let's do the bitmap creation first, update the
drivers to properly set the bitmap, then do all of the remaining reforms
you have here using that bitmap and completely skip the
query_transport() API item that will no longer serve a purpose.

> Mapping List:
>   node-type   link-layer  old-transport   new-transport
> nes   RNICETH IWARP   IWARP
> amso1100  RNICETH IWARP   IWARP
> cxgb3 RNICETH IWARP   IWARP
> cxgb4 RNICETH IWARP   IWARP
> usnic USNIC_UDP   ETH USNIC_UDP   USNIC_UDP
> ocrdmaIB_CA   ETH IB  IBOE
> mlx4  IB_CA   IB/ETH  IB  IB/IBOE
> mlx5  IB_CA   IB  IB  IB
> ehca  IB_CA   IB  IB  IB
> ipath IB_CA   IB  IB  IB
> mthca IB_CA   IB  IB  IB
> qib   IB_CA   IB  IB  IB
> 
> Cc: Hal Rosenstock 
> Cc: Steve Wise 
> Cc: Tom Talpey 
> Cc: Jason Gunthorpe 
> Cc: Doug Ledford 
> Cc: Ira Weiny 
> Cc: Sean Hefty 
> Signed-off-by: Michael Wang 
> ---
>  drivers/infiniband/core/device.c |  1 +
>  drivers/infiniband/core/verbs.c  |  4 +++-
>  drivers/infiniband/hw/amso1100/c2_provider.c |  7 +++
>  drivers/infiniband/hw/cxgb3/iwch_provider.c  |  7 +++
>  drivers/infiniband/hw/cxgb4/provider.c   |  7 +++
>  drivers/infiniband/hw/ehca/ehca_hca.c|  6 ++
>  drivers/infiniband/hw/ehca/ehca_iverbs.h |  3 +++
>  drivers/infiniband/hw/ehca/ehca_main.c   |  1 +
>  drivers/infiniband/hw/ipath/ipath_verbs.c|  7 +++
>  drivers/infiniband/hw/mlx4/main.c| 10 ++
>  drivers/infiniband/hw/mlx5/main.c|  7 +++
>  drivers/infiniband/hw/mthca/mthca_provider.c |  7 +++
>  drivers/infiniband/hw/nes/nes_verbs.c|  6 ++
>  drivers/infiniband/hw/ocrdma/ocrdma_main.c   |  1 +
>  drivers/infiniband/hw/ocrdma/ocrdma_verbs.c  |  6 ++
>  drivers/infiniband/hw/ocrdma/ocrdma_verbs.h  |  3 +++
>  drivers/infiniband/hw/qib/qib_verbs.c|  7 +++
>  drivers/infiniband/hw/usnic/usnic_ib_main.c  |  1 +
>  drivers/infiniband/hw/usnic/usnic_ib_verbs.c |  6 ++
>  drivers/infiniband/hw/usnic/usnic_ib_verbs.h |  2 ++
>  include/rdma/ib_verbs.h  |  7 ++-
>  21 files changed, 104 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/infiniband/core/device.c 
> b/drivers/infiniband/core/device.c
> index 18c1ece..a9587c4 100644
> --- a/drivers/infiniband/core/device.c
> +++ b/drivers/infiniband/core/device.c
> @@ -76,6 +76,7 @@ static int ib_device_check_mandatory(struct ib_device 
> *device)
>   } mandatory_table[] = {
>   IB_MANDATORY_FUNC(query_device),
>   IB_MANDATORY_FUNC(query_port),
> + IB_MANDATORY_FUNC(query_transport),
>   IB_MANDATORY_FUNC(query_pkey),
>   IB_MANDATORY_FUNC(query_gid),
>   IB_MANDATORY_FUNC(alloc_pd),
> diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c
> index f93eb8d..626c9cf 100644
> --- a/drivers/infiniband/core/verbs.c
> +++ b/drivers/infiniband/core/verbs.c
> @@ -133,14 +133,16 @@ enum rdma_link_layer rdma_port_get_link_layer(struct 
> ib_device *device, u8 port_
>   if (device->get_link_layer)
>   return device->get_link_layer(device, port_num);
>  
> - switch (rdma_node_get_transport(device->node_type)) {
> + switch (device->query_transport(device, port_num)) {
>   case RDMA_TRANSPORT_IB:
>   return IB_LINK_LAYER_INFINIBAND;
> + case RDMA_TRANSPORT_IBOE:
>   case RDMA_TRANSPORT_IWARP:
>   case RDMA_TRANSPORT_USNIC:
>   case RDMA_TRANSPORT_USNIC_UDP:
>   return IB_LINK_LAYER_ETHERNET;
>   default:
> + BUG();
>   return IB_LINK_LAYER_UNSPECIFIED;
>   }
>  }
> diff --git a/drivers/infiniband/hw/amso1100/c2_provider.c 
> b/drivers/infiniband/hw/amso1100/c2_provider.c
> index bdf3507..d46bbb0 100644
> --- a/drivers/infiniband/hw/amso1100/c2_provider.c
> +++ b/drivers/infiniband/hw/amso1100/c2_provider.c
> @@ -99,6 +99,12 

Re: [PATCH v5 01/27] IB/Verbs: Implement new callback query_transport()

2015-04-22 Thread ira.weiny
On Wed, Apr 22, 2015 at 03:21:43PM +, Devesh Sharma wrote:
  -Original Message-
  From: linux-rdma-ow...@vger.kernel.org [mailto:linux-rdma-
  ow...@vger.kernel.org] On Behalf Of Doug Ledford
  Sent: Wednesday, April 22, 2015 8:33 PM
  To: Michael Wang
  Cc: Roland Dreier; Sean Hefty; linux-r...@vger.kernel.org; linux-
  ker...@vger.kernel.org; h...@dev.mellanox.co.il; Tom Tucker; Steve Wise;
  Hoang-Nam Nguyen; Christoph Raisch; Mike Marciniszyn; Eli Cohen; Faisal
  Latif; Jack Morgenstein; Or Gerlitz; Haggai Eran; Ira Weiny; Tom Talpey; 
  Jason
  Gunthorpe
  Subject: Re: [PATCH v5 01/27] IB/Verbs: Implement new callback
  query_transport()
  
  On Mon, 2015-04-20 at 10:32 +0200, Michael Wang wrote:
   Add new callback query_transport() and implement for each HW.
  
  The more I think about it, the more I think we need to eliminate this patch
  entirely.
  
  The problem here is that, if we follow my suggestion, then we are going to
  eliminate the query as an API function and replace the information it gives 
  us
  with a static port attribute bitmap.  If we do this patch, then reform this 
  patch
  to my idea later, we introduce a very short lived API/ABI change in the 
  kernel
  module interface that serves absolutely no purpose.  Instead, let's do the
  bitmap creation first, update the drivers to properly set the bitmap, then 
  do all
  of the remaining reforms you have here using that bitmap and completely skip
  the
  query_transport() API item that will no longer serve a purpose.
 
 Any vendor device that registers with IB stack already has capability flags, 
 are you referring to the same as bit maps?
 Is it possible to use same as bitmaps you are referring to? I am trying to 
 understand you complete idea.

The idea was to use additional bit maps.

https://www.mail-archive.com/linux-rdma@vger.kernel.org/msg23765.html

Ira

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v5 01/27] IB/Verbs: Implement new callback query_transport()

2015-04-22 Thread Doug Ledford
On Wed, 2015-04-22 at 15:21 +, Devesh Sharma wrote:
  -Original Message-
  From: linux-rdma-ow...@vger.kernel.org [mailto:linux-rdma-
  ow...@vger.kernel.org] On Behalf Of Doug Ledford
  Sent: Wednesday, April 22, 2015 8:33 PM
  To: Michael Wang
  Cc: Roland Dreier; Sean Hefty; linux-r...@vger.kernel.org; linux-
  ker...@vger.kernel.org; h...@dev.mellanox.co.il; Tom Tucker; Steve Wise;
  Hoang-Nam Nguyen; Christoph Raisch; Mike Marciniszyn; Eli Cohen; Faisal
  Latif; Jack Morgenstein; Or Gerlitz; Haggai Eran; Ira Weiny; Tom Talpey; 
  Jason
  Gunthorpe
  Subject: Re: [PATCH v5 01/27] IB/Verbs: Implement new callback
  query_transport()
  
  On Mon, 2015-04-20 at 10:32 +0200, Michael Wang wrote:
   Add new callback query_transport() and implement for each HW.
  
  The more I think about it, the more I think we need to eliminate this patch
  entirely.
  
  The problem here is that, if we follow my suggestion, then we are going to
  eliminate the query as an API function and replace the information it gives 
  us
  with a static port attribute bitmap.  If we do this patch, then reform this 
  patch
  to my idea later, we introduce a very short lived API/ABI change in the 
  kernel
  module interface that serves absolutely no purpose.  Instead, let's do the
  bitmap creation first, update the drivers to properly set the bitmap, then 
  do all
  of the remaining reforms you have here using that bitmap and completely skip
  the
  query_transport() API item that will no longer serve a purpose.
 
 Any vendor device that registers with IB stack already has capability flags, 
 are you referring to the same as bit maps?
 Is it possible to use same as bitmaps you are referring to? I am trying to 
 understand you complete idea.

There are two capability flags right now, a device caps flag set and a
port caps flag set (not counting possible driver internal flags).
Regardless of whether or not we wanted to use one or the other, they are
both too full to be used for our purposes.  We can't get enough bits.
We would get to drop the node_type, but that's only a u8 and so it
doesn't have enough bits either.  In addition, node_type is set per
device, and it would really be best if our new bitmap were per port.

That then raises the issue that right now, the core code doesn't have
direct access to per-port information, everything is done via a
combination of direct access to the per device node check and per port
driver callbacks.  We may have no choice but to continue with that for
now, but I find that inefficient.  And if we make the bitmap per port,
then even our node check becomes a callback.

So, what we need to do, is define a specific bitmap just for the
node/transport/link bits and the capability bits that explicitly go with
that tuple *and* define a way to access it without necessarily requiring
a callback.

Michael's patch set has gone through a lot of revisions and I think we
are getting close to the set of things we want to know, so it shouldn't
be that hard now to create the proper bitmap that makes knowing those
things quick and efficient.

The harder part will be making it accessible.  Since the current struct
ib_device doesn't include direct access to the ports (it has a list head
for port_list, but that's just for the sysfs entries for this device, it
doesn't hold anything we can use for this) we are limited to either A)
adding a new callback or B) changing node_type to port_type, making it a
larger size, and making it a port indexed array.

-- 
Doug Ledford dledf...@redhat.com
  GPG KeyID: 0E572FDD




signature.asc
Description: This is a digitally signed message part


Re: [PATCH v5 01/27] IB/Verbs: Implement new callback query_transport()

2015-04-22 Thread Doug Ledford
On Mon, 2015-04-20 at 10:32 +0200, Michael Wang wrote:
 Add new callback query_transport() and implement for each HW.

The more I think about it, the more I think we need to eliminate this
patch entirely.

The problem here is that, if we follow my suggestion, then we are going
to eliminate the query as an API function and replace the information it
gives us with a static port attribute bitmap.  If we do this patch, then
reform this patch to my idea later, we introduce a very short lived
API/ABI change in the kernel module interface that serves absolutely no
purpose.  Instead, let's do the bitmap creation first, update the
drivers to properly set the bitmap, then do all of the remaining reforms
you have here using that bitmap and completely skip the
query_transport() API item that will no longer serve a purpose.

 Mapping List:
   node-type   link-layer  old-transport   new-transport
 nes   RNICETH IWARP   IWARP
 amso1100  RNICETH IWARP   IWARP
 cxgb3 RNICETH IWARP   IWARP
 cxgb4 RNICETH IWARP   IWARP
 usnic USNIC_UDP   ETH USNIC_UDP   USNIC_UDP
 ocrdmaIB_CA   ETH IB  IBOE
 mlx4  IB_CA   IB/ETH  IB  IB/IBOE
 mlx5  IB_CA   IB  IB  IB
 ehca  IB_CA   IB  IB  IB
 ipath IB_CA   IB  IB  IB
 mthca IB_CA   IB  IB  IB
 qib   IB_CA   IB  IB  IB
 
 Cc: Hal Rosenstock h...@dev.mellanox.co.il
 Cc: Steve Wise sw...@opengridcomputing.com
 Cc: Tom Talpey t...@talpey.com
 Cc: Jason Gunthorpe jguntho...@obsidianresearch.com
 Cc: Doug Ledford dledf...@redhat.com
 Cc: Ira Weiny ira.we...@intel.com
 Cc: Sean Hefty sean.he...@intel.com
 Signed-off-by: Michael Wang yun.w...@profitbricks.com
 ---
  drivers/infiniband/core/device.c |  1 +
  drivers/infiniband/core/verbs.c  |  4 +++-
  drivers/infiniband/hw/amso1100/c2_provider.c |  7 +++
  drivers/infiniband/hw/cxgb3/iwch_provider.c  |  7 +++
  drivers/infiniband/hw/cxgb4/provider.c   |  7 +++
  drivers/infiniband/hw/ehca/ehca_hca.c|  6 ++
  drivers/infiniband/hw/ehca/ehca_iverbs.h |  3 +++
  drivers/infiniband/hw/ehca/ehca_main.c   |  1 +
  drivers/infiniband/hw/ipath/ipath_verbs.c|  7 +++
  drivers/infiniband/hw/mlx4/main.c| 10 ++
  drivers/infiniband/hw/mlx5/main.c|  7 +++
  drivers/infiniband/hw/mthca/mthca_provider.c |  7 +++
  drivers/infiniband/hw/nes/nes_verbs.c|  6 ++
  drivers/infiniband/hw/ocrdma/ocrdma_main.c   |  1 +
  drivers/infiniband/hw/ocrdma/ocrdma_verbs.c  |  6 ++
  drivers/infiniband/hw/ocrdma/ocrdma_verbs.h  |  3 +++
  drivers/infiniband/hw/qib/qib_verbs.c|  7 +++
  drivers/infiniband/hw/usnic/usnic_ib_main.c  |  1 +
  drivers/infiniband/hw/usnic/usnic_ib_verbs.c |  6 ++
  drivers/infiniband/hw/usnic/usnic_ib_verbs.h |  2 ++
  include/rdma/ib_verbs.h  |  7 ++-
  21 files changed, 104 insertions(+), 2 deletions(-)
 
 diff --git a/drivers/infiniband/core/device.c 
 b/drivers/infiniband/core/device.c
 index 18c1ece..a9587c4 100644
 --- a/drivers/infiniband/core/device.c
 +++ b/drivers/infiniband/core/device.c
 @@ -76,6 +76,7 @@ static int ib_device_check_mandatory(struct ib_device 
 *device)
   } mandatory_table[] = {
   IB_MANDATORY_FUNC(query_device),
   IB_MANDATORY_FUNC(query_port),
 + IB_MANDATORY_FUNC(query_transport),
   IB_MANDATORY_FUNC(query_pkey),
   IB_MANDATORY_FUNC(query_gid),
   IB_MANDATORY_FUNC(alloc_pd),
 diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c
 index f93eb8d..626c9cf 100644
 --- a/drivers/infiniband/core/verbs.c
 +++ b/drivers/infiniband/core/verbs.c
 @@ -133,14 +133,16 @@ enum rdma_link_layer rdma_port_get_link_layer(struct 
 ib_device *device, u8 port_
   if (device-get_link_layer)
   return device-get_link_layer(device, port_num);
  
 - switch (rdma_node_get_transport(device-node_type)) {
 + switch (device-query_transport(device, port_num)) {
   case RDMA_TRANSPORT_IB:
   return IB_LINK_LAYER_INFINIBAND;
 + case RDMA_TRANSPORT_IBOE:
   case RDMA_TRANSPORT_IWARP:
   case RDMA_TRANSPORT_USNIC:
   case RDMA_TRANSPORT_USNIC_UDP:
   return IB_LINK_LAYER_ETHERNET;
   default:
 + BUG();
   return IB_LINK_LAYER_UNSPECIFIED;
   }
  }
 diff --git a/drivers/infiniband/hw/amso1100/c2_provider.c 
 b/drivers/infiniband/hw/amso1100/c2_provider.c
 index bdf3507..d46bbb0 100644
 --- 

RE: [PATCH v5 01/27] IB/Verbs: Implement new callback query_transport()

2015-04-22 Thread Devesh Sharma
 -Original Message-
 From: linux-rdma-ow...@vger.kernel.org [mailto:linux-rdma-
 ow...@vger.kernel.org] On Behalf Of Doug Ledford
 Sent: Wednesday, April 22, 2015 8:33 PM
 To: Michael Wang
 Cc: Roland Dreier; Sean Hefty; linux-r...@vger.kernel.org; linux-
 ker...@vger.kernel.org; h...@dev.mellanox.co.il; Tom Tucker; Steve Wise;
 Hoang-Nam Nguyen; Christoph Raisch; Mike Marciniszyn; Eli Cohen; Faisal
 Latif; Jack Morgenstein; Or Gerlitz; Haggai Eran; Ira Weiny; Tom Talpey; Jason
 Gunthorpe
 Subject: Re: [PATCH v5 01/27] IB/Verbs: Implement new callback
 query_transport()
 
 On Mon, 2015-04-20 at 10:32 +0200, Michael Wang wrote:
  Add new callback query_transport() and implement for each HW.
 
 The more I think about it, the more I think we need to eliminate this patch
 entirely.
 
 The problem here is that, if we follow my suggestion, then we are going to
 eliminate the query as an API function and replace the information it gives us
 with a static port attribute bitmap.  If we do this patch, then reform this 
 patch
 to my idea later, we introduce a very short lived API/ABI change in the kernel
 module interface that serves absolutely no purpose.  Instead, let's do the
 bitmap creation first, update the drivers to properly set the bitmap, then do 
 all
 of the remaining reforms you have here using that bitmap and completely skip
 the
 query_transport() API item that will no longer serve a purpose.

Any vendor device that registers with IB stack already has capability flags, 
are you referring to the same as bit maps?
Is it possible to use same as bitmaps you are referring to? I am trying to 
understand you complete idea.

 
  Mapping List:
  node-type   link-layer  old-transport   new-transport
  nes RNICETH IWARP   IWARP
  amso1100RNICETH IWARP   IWARP
  cxgb3   RNICETH IWARP   IWARP
  cxgb4   RNICETH IWARP   IWARP
  usnic   USNIC_UDP   ETH USNIC_UDP   USNIC_UDP
  ocrdma  IB_CA   ETH IB  IBOE
  mlx4IB_CA   IB/ETH  IB  IB/IBOE
  mlx5IB_CA   IB  IB  IB
  ehcaIB_CA   IB  IB  IB
  ipath   IB_CA   IB  IB  IB
  mthca   IB_CA   IB  IB  IB
  qib IB_CA   IB  IB  IB
 
  Cc: Hal Rosenstock h...@dev.mellanox.co.il
  Cc: Steve Wise sw...@opengridcomputing.com
  Cc: Tom Talpey t...@talpey.com
  Cc: Jason Gunthorpe jguntho...@obsidianresearch.com
  Cc: Doug Ledford dledf...@redhat.com
  Cc: Ira Weiny ira.we...@intel.com
  Cc: Sean Hefty sean.he...@intel.com
  Signed-off-by: Michael Wang yun.w...@profitbricks.com
  ---
   drivers/infiniband/core/device.c |  1 +
   drivers/infiniband/core/verbs.c  |  4 +++-
   drivers/infiniband/hw/amso1100/c2_provider.c |  7 +++
  drivers/infiniband/hw/cxgb3/iwch_provider.c  |  7 +++
   drivers/infiniband/hw/cxgb4/provider.c   |  7 +++
   drivers/infiniband/hw/ehca/ehca_hca.c|  6 ++
   drivers/infiniband/hw/ehca/ehca_iverbs.h |  3 +++
   drivers/infiniband/hw/ehca/ehca_main.c   |  1 +
   drivers/infiniband/hw/ipath/ipath_verbs.c|  7 +++
   drivers/infiniband/hw/mlx4/main.c| 10 ++
   drivers/infiniband/hw/mlx5/main.c|  7 +++
   drivers/infiniband/hw/mthca/mthca_provider.c |  7 +++
   drivers/infiniband/hw/nes/nes_verbs.c|  6 ++
   drivers/infiniband/hw/ocrdma/ocrdma_main.c   |  1 +
   drivers/infiniband/hw/ocrdma/ocrdma_verbs.c  |  6 ++
  drivers/infiniband/hw/ocrdma/ocrdma_verbs.h  |  3 +++
   drivers/infiniband/hw/qib/qib_verbs.c|  7 +++
   drivers/infiniband/hw/usnic/usnic_ib_main.c  |  1 +
  drivers/infiniband/hw/usnic/usnic_ib_verbs.c |  6 ++
  drivers/infiniband/hw/usnic/usnic_ib_verbs.h |  2 ++
   include/rdma/ib_verbs.h  |  7 ++-
   21 files changed, 104 insertions(+), 2 deletions(-)
 
  diff --git a/drivers/infiniband/core/device.c
  b/drivers/infiniband/core/device.c
  index 18c1ece..a9587c4 100644
  --- a/drivers/infiniband/core/device.c
  +++ b/drivers/infiniband/core/device.c
  @@ -76,6 +76,7 @@ static int ib_device_check_mandatory(struct ib_device
 *device)
  } mandatory_table[] = {
  IB_MANDATORY_FUNC(query_device),
  IB_MANDATORY_FUNC(query_port),
  +   IB_MANDATORY_FUNC(query_transport),
  IB_MANDATORY_FUNC(query_pkey),
  IB_MANDATORY_FUNC(query_gid),
  IB_MANDATORY_FUNC(alloc_pd),
  diff --git a/drivers/infiniband/core/verbs.c
  b/drivers/infiniband/core/verbs.c index f93eb8d..626c9cf 100644
  --- a/drivers/infiniband/core/verbs.c
  +++ b/drivers/infiniband/core/verbs.c
  @@ -133,14

Re: [PATCH v5 01/27] IB/Verbs: Implement new callback query_transport()

2015-04-21 Thread ira.weiny
On Mon, Apr 20, 2015 at 10:32:01AM +0200, Michael Wang wrote:
> 
> Add new callback query_transport() and implement for each HW.
> 
> Mapping List:
>   node-type   link-layer  old-transport   new-transport
> nes   RNICETH IWARP   IWARP
> amso1100  RNICETH IWARP   IWARP
> cxgb3 RNICETH IWARP   IWARP
> cxgb4 RNICETH IWARP   IWARP
> usnic USNIC_UDP   ETH USNIC_UDP   USNIC_UDP
> ocrdmaIB_CA   ETH IB  IBOE
> mlx4  IB_CA   IB/ETH  IB  IB/IBOE
> mlx5  IB_CA   IB  IB  IB
> ehca  IB_CA   IB  IB  IB
> ipath IB_CA   IB  IB  IB
> mthca IB_CA   IB  IB  IB
> qib   IB_CA   IB  IB  IB
> 
> Cc: Hal Rosenstock 
> Cc: Steve Wise 
> Cc: Tom Talpey 
> Cc: Jason Gunthorpe 
> Cc: Doug Ledford 
> Cc: Ira Weiny 
> Cc: Sean Hefty 
> Signed-off-by: Michael Wang 

Reviewed-by: Ira Weiny 

> ---
>  drivers/infiniband/core/device.c |  1 +
>  drivers/infiniband/core/verbs.c  |  4 +++-
>  drivers/infiniband/hw/amso1100/c2_provider.c |  7 +++
>  drivers/infiniband/hw/cxgb3/iwch_provider.c  |  7 +++
>  drivers/infiniband/hw/cxgb4/provider.c   |  7 +++
>  drivers/infiniband/hw/ehca/ehca_hca.c|  6 ++
>  drivers/infiniband/hw/ehca/ehca_iverbs.h |  3 +++
>  drivers/infiniband/hw/ehca/ehca_main.c   |  1 +
>  drivers/infiniband/hw/ipath/ipath_verbs.c|  7 +++
>  drivers/infiniband/hw/mlx4/main.c| 10 ++
>  drivers/infiniband/hw/mlx5/main.c|  7 +++
>  drivers/infiniband/hw/mthca/mthca_provider.c |  7 +++
>  drivers/infiniband/hw/nes/nes_verbs.c|  6 ++
>  drivers/infiniband/hw/ocrdma/ocrdma_main.c   |  1 +
>  drivers/infiniband/hw/ocrdma/ocrdma_verbs.c  |  6 ++
>  drivers/infiniband/hw/ocrdma/ocrdma_verbs.h  |  3 +++
>  drivers/infiniband/hw/qib/qib_verbs.c|  7 +++
>  drivers/infiniband/hw/usnic/usnic_ib_main.c  |  1 +
>  drivers/infiniband/hw/usnic/usnic_ib_verbs.c |  6 ++
>  drivers/infiniband/hw/usnic/usnic_ib_verbs.h |  2 ++
>  include/rdma/ib_verbs.h  |  7 ++-
>  21 files changed, 104 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/infiniband/core/device.c 
> b/drivers/infiniband/core/device.c
> index 18c1ece..a9587c4 100644
> --- a/drivers/infiniband/core/device.c
> +++ b/drivers/infiniband/core/device.c
> @@ -76,6 +76,7 @@ static int ib_device_check_mandatory(struct ib_device 
> *device)
>   } mandatory_table[] = {
>   IB_MANDATORY_FUNC(query_device),
>   IB_MANDATORY_FUNC(query_port),
> + IB_MANDATORY_FUNC(query_transport),
>   IB_MANDATORY_FUNC(query_pkey),
>   IB_MANDATORY_FUNC(query_gid),
>   IB_MANDATORY_FUNC(alloc_pd),
> diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c
> index f93eb8d..626c9cf 100644
> --- a/drivers/infiniband/core/verbs.c
> +++ b/drivers/infiniband/core/verbs.c
> @@ -133,14 +133,16 @@ enum rdma_link_layer rdma_port_get_link_layer(struct 
> ib_device *device, u8 port_
>   if (device->get_link_layer)
>   return device->get_link_layer(device, port_num);
>  
> - switch (rdma_node_get_transport(device->node_type)) {
> + switch (device->query_transport(device, port_num)) {
>   case RDMA_TRANSPORT_IB:
>   return IB_LINK_LAYER_INFINIBAND;
> + case RDMA_TRANSPORT_IBOE:
>   case RDMA_TRANSPORT_IWARP:
>   case RDMA_TRANSPORT_USNIC:
>   case RDMA_TRANSPORT_USNIC_UDP:
>   return IB_LINK_LAYER_ETHERNET;
>   default:
> + BUG();
>   return IB_LINK_LAYER_UNSPECIFIED;
>   }
>  }
> diff --git a/drivers/infiniband/hw/amso1100/c2_provider.c 
> b/drivers/infiniband/hw/amso1100/c2_provider.c
> index bdf3507..d46bbb0 100644
> --- a/drivers/infiniband/hw/amso1100/c2_provider.c
> +++ b/drivers/infiniband/hw/amso1100/c2_provider.c
> @@ -99,6 +99,12 @@ static int c2_query_port(struct ib_device *ibdev,
>   return 0;
>  }
>  
> +static enum rdma_transport_type
> +c2_query_transport(struct ib_device *device, u8 port_num)
> +{
> + return RDMA_TRANSPORT_IWARP;
> +}
> +
>  static int c2_query_pkey(struct ib_device *ibdev,
>u8 port, u16 index, u16 * pkey)
>  {
> @@ -801,6 +807,7 @@ int c2_register_device(struct c2_dev *dev)
>   dev->ibdev.dma_device = >pcidev->dev;
>   dev->ibdev.query_device = c2_query_device;
>   dev->ibdev.query_port = c2_query_port;
> + dev->ibdev.query_transport = c2_query_transport;
>   dev->ibdev.query_pkey = c2_query_pkey;
>   

Re: [PATCH v5 01/27] IB/Verbs: Implement new callback query_transport()

2015-04-21 Thread ira.weiny
On Mon, Apr 20, 2015 at 10:32:01AM +0200, Michael Wang wrote:
 
 Add new callback query_transport() and implement for each HW.
 
 Mapping List:
   node-type   link-layer  old-transport   new-transport
 nes   RNICETH IWARP   IWARP
 amso1100  RNICETH IWARP   IWARP
 cxgb3 RNICETH IWARP   IWARP
 cxgb4 RNICETH IWARP   IWARP
 usnic USNIC_UDP   ETH USNIC_UDP   USNIC_UDP
 ocrdmaIB_CA   ETH IB  IBOE
 mlx4  IB_CA   IB/ETH  IB  IB/IBOE
 mlx5  IB_CA   IB  IB  IB
 ehca  IB_CA   IB  IB  IB
 ipath IB_CA   IB  IB  IB
 mthca IB_CA   IB  IB  IB
 qib   IB_CA   IB  IB  IB
 
 Cc: Hal Rosenstock h...@dev.mellanox.co.il
 Cc: Steve Wise sw...@opengridcomputing.com
 Cc: Tom Talpey t...@talpey.com
 Cc: Jason Gunthorpe jguntho...@obsidianresearch.com
 Cc: Doug Ledford dledf...@redhat.com
 Cc: Ira Weiny ira.we...@intel.com
 Cc: Sean Hefty sean.he...@intel.com
 Signed-off-by: Michael Wang yun.w...@profitbricks.com

Reviewed-by: Ira Weiny ira.we...@intel.com

 ---
  drivers/infiniband/core/device.c |  1 +
  drivers/infiniband/core/verbs.c  |  4 +++-
  drivers/infiniband/hw/amso1100/c2_provider.c |  7 +++
  drivers/infiniband/hw/cxgb3/iwch_provider.c  |  7 +++
  drivers/infiniband/hw/cxgb4/provider.c   |  7 +++
  drivers/infiniband/hw/ehca/ehca_hca.c|  6 ++
  drivers/infiniband/hw/ehca/ehca_iverbs.h |  3 +++
  drivers/infiniband/hw/ehca/ehca_main.c   |  1 +
  drivers/infiniband/hw/ipath/ipath_verbs.c|  7 +++
  drivers/infiniband/hw/mlx4/main.c| 10 ++
  drivers/infiniband/hw/mlx5/main.c|  7 +++
  drivers/infiniband/hw/mthca/mthca_provider.c |  7 +++
  drivers/infiniband/hw/nes/nes_verbs.c|  6 ++
  drivers/infiniband/hw/ocrdma/ocrdma_main.c   |  1 +
  drivers/infiniband/hw/ocrdma/ocrdma_verbs.c  |  6 ++
  drivers/infiniband/hw/ocrdma/ocrdma_verbs.h  |  3 +++
  drivers/infiniband/hw/qib/qib_verbs.c|  7 +++
  drivers/infiniband/hw/usnic/usnic_ib_main.c  |  1 +
  drivers/infiniband/hw/usnic/usnic_ib_verbs.c |  6 ++
  drivers/infiniband/hw/usnic/usnic_ib_verbs.h |  2 ++
  include/rdma/ib_verbs.h  |  7 ++-
  21 files changed, 104 insertions(+), 2 deletions(-)
 
 diff --git a/drivers/infiniband/core/device.c 
 b/drivers/infiniband/core/device.c
 index 18c1ece..a9587c4 100644
 --- a/drivers/infiniband/core/device.c
 +++ b/drivers/infiniband/core/device.c
 @@ -76,6 +76,7 @@ static int ib_device_check_mandatory(struct ib_device 
 *device)
   } mandatory_table[] = {
   IB_MANDATORY_FUNC(query_device),
   IB_MANDATORY_FUNC(query_port),
 + IB_MANDATORY_FUNC(query_transport),
   IB_MANDATORY_FUNC(query_pkey),
   IB_MANDATORY_FUNC(query_gid),
   IB_MANDATORY_FUNC(alloc_pd),
 diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c
 index f93eb8d..626c9cf 100644
 --- a/drivers/infiniband/core/verbs.c
 +++ b/drivers/infiniband/core/verbs.c
 @@ -133,14 +133,16 @@ enum rdma_link_layer rdma_port_get_link_layer(struct 
 ib_device *device, u8 port_
   if (device-get_link_layer)
   return device-get_link_layer(device, port_num);
  
 - switch (rdma_node_get_transport(device-node_type)) {
 + switch (device-query_transport(device, port_num)) {
   case RDMA_TRANSPORT_IB:
   return IB_LINK_LAYER_INFINIBAND;
 + case RDMA_TRANSPORT_IBOE:
   case RDMA_TRANSPORT_IWARP:
   case RDMA_TRANSPORT_USNIC:
   case RDMA_TRANSPORT_USNIC_UDP:
   return IB_LINK_LAYER_ETHERNET;
   default:
 + BUG();
   return IB_LINK_LAYER_UNSPECIFIED;
   }
  }
 diff --git a/drivers/infiniband/hw/amso1100/c2_provider.c 
 b/drivers/infiniband/hw/amso1100/c2_provider.c
 index bdf3507..d46bbb0 100644
 --- a/drivers/infiniband/hw/amso1100/c2_provider.c
 +++ b/drivers/infiniband/hw/amso1100/c2_provider.c
 @@ -99,6 +99,12 @@ static int c2_query_port(struct ib_device *ibdev,
   return 0;
  }
  
 +static enum rdma_transport_type
 +c2_query_transport(struct ib_device *device, u8 port_num)
 +{
 + return RDMA_TRANSPORT_IWARP;
 +}
 +
  static int c2_query_pkey(struct ib_device *ibdev,
u8 port, u16 index, u16 * pkey)
  {
 @@ -801,6 +807,7 @@ int c2_register_device(struct c2_dev *dev)
   dev-ibdev.dma_device = dev-pcidev-dev;
   dev-ibdev.query_device = c2_query_device;
   dev-ibdev.query_port = c2_query_port;
 + dev-ibdev.query_transport