diff mbox

[RFC,3/5] IB/core: Convert cap_ib_mad to core_cap_flags bit mask

Message ID 1430720099-32512-4-git-send-email-ira.weiny@intel.com (mailing list archive)
State Rejected
Headers show

Commit Message

Ira Weiny May 4, 2015, 6:14 a.m. UTC
From: Ira Weiny <ira.weiny@intel.com>

Use the new Core Capability bits instead of inferring this support from the
protocol.

Signed-off-by: Ira Weiny <ira.weiny@intel.com>
---
 drivers/infiniband/hw/ehca/ehca_hca.c        |    2 +-
 drivers/infiniband/hw/ipath/ipath_verbs.c    |    2 +-
 drivers/infiniband/hw/mlx4/main.c            |    4 ++--
 drivers/infiniband/hw/mlx5/main.c            |    2 +-
 drivers/infiniband/hw/mthca/mthca_provider.c |    2 +-
 drivers/infiniband/hw/qib/qib_verbs.c        |    2 +-
 include/rdma/ib_verbs.h                      |    2 +-
 7 files changed, 8 insertions(+), 8 deletions(-)

Comments

Hefty, Sean May 4, 2015, 4:49 p.m. UTC | #1
> Subject: [RFC PATCH 3/5] IB/core: Convert cap_ib_mad to core_cap_flags bit
> mask
> 
> From: Ira Weiny <ira.weiny@intel.com>
> 
> Use the new Core Capability bits instead of inferring this support from
> the
> protocol.

It would help if the patch description defined what this bit meant.  E.g. why aren't more specific definitions (SMI, CM, GSI, PM, etc.) less desirable than just 'MAD'?


--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jason Gunthorpe May 4, 2015, 6:46 p.m. UTC | #2
On Mon, May 04, 2015 at 02:14:57AM -0400, ira.weiny@intel.com wrote:

> Use the new Core Capability bits instead of inferring this support from the
> protocol.

Does this really need to be a seperate patch? At least for the
core_cap_flags parts it makes no sense to change those lines twice

> -	props->core_cap_flags = RDMA_CORE_CAP_PROT_IB;
> +	props->core_cap_flags = RDMA_CORE_CAP_PROT_IB | RDMA_CORE_CAP_IB_MAD;

Hurm,

Maybe add some macros to help this out, document the standard that
the port implements:

#define RDMA_CORE_PORT_IB_IBA_v1_2 (RDMA_CORE_CAP_PROT_IB | RDMA_CORE_CAP_IB_MAD)
#define RDMA_CORE_PORT_ROCEE_IBA_v1_2_A15 ..
#define RDMA_CORE_PORT_ROCEE_IBA_v1_3_A16 ..

>  static inline int cap_ib_mad(struct ib_device *device, u8 port_num)
>  {
> -	return rdma_ib_or_iboe(device, port_num);
> +	return !!(device->core_cap_flags[port_num] & RDMA_CORE_CAP_IB_MAD);


'bool' is OK in the kernel, just use that instead of !! - in fact all of
thse cap returns should return bool. Michael should fix that in his
series too.

Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Ira Weiny May 4, 2015, 10:43 p.m. UTC | #3
On Mon, May 04, 2015 at 12:46:10PM -0600, Jason Gunthorpe wrote:
> On Mon, May 04, 2015 at 02:14:57AM -0400, ira.weiny@intel.com wrote:
> 
> > Use the new Core Capability bits instead of inferring this support from the
> > protocol.
> 
> Does this really need to be a seperate patch? At least for the
> core_cap_flags parts it makes no sense to change those lines twice

Only to show the progression and for me to test as I went.  I think a squash is
good.  I just was taking my testing slowly to make sure I did not do something
stupid...  ;-)

> 
> > -	props->core_cap_flags = RDMA_CORE_CAP_PROT_IB;
> > +	props->core_cap_flags = RDMA_CORE_CAP_PROT_IB | RDMA_CORE_CAP_IB_MAD;
> 
> Hurm,
> 
> Maybe add some macros to help this out, document the standard that
> the port implements:
> 
> #define RDMA_CORE_PORT_IB_IBA_v1_2 (RDMA_CORE_CAP_PROT_IB | RDMA_CORE_CAP_IB_MAD)
> #define RDMA_CORE_PORT_ROCEE_IBA_v1_2_A15 ..
> #define RDMA_CORE_PORT_ROCEE_IBA_v1_3_A16 ..

Good idea.

> 
> >  static inline int cap_ib_mad(struct ib_device *device, u8 port_num)
> >  {
> > -	return rdma_ib_or_iboe(device, port_num);
> > +	return !!(device->core_cap_flags[port_num] & RDMA_CORE_CAP_IB_MAD);
> 
> 
> 'bool' is OK in the kernel, just use that instead of !! - in fact all of
> thse cap returns should return bool. Michael should fix that in his
> series too.

Michael?

Ira

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Michael Wang May 5, 2015, 8 a.m. UTC | #4
On 05/05/2015 12:43 AM, ira.weiny wrote:
[snip]
> 
>>
>>>  static inline int cap_ib_mad(struct ib_device *device, u8 port_num)
>>>  {
>>> -	return rdma_ib_or_iboe(device, port_num);
>>> +	return !!(device->core_cap_flags[port_num] & RDMA_CORE_CAP_IB_MAD);
>>
>>
>> 'bool' is OK in the kernel, just use that instead of !! - in fact all of
>> thse cap returns should return bool. Michael should fix that in his
>> series too.
> 
> Michael?

Ok, I will use bool in next version :-)

Regards,
Michael Wang

> 
> Ira
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Michael Wang May 5, 2015, 8:26 a.m. UTC | #5
On 05/04/2015 08:46 PM, Jason Gunthorpe wrote:
> On Mon, May 04, 2015 at 02:14:57AM -0400, ira.weiny@intel.com wrote:
> 
>> Use the new Core Capability bits instead of inferring this support from the
>> protocol.
> 
> Does this really need to be a seperate patch? At least for the
> core_cap_flags parts it makes no sense to change those lines twice

I think I missed this patch series, and I can't find all the 5 patch in
archive too...

If there are not much argument on this proposal, then we can include
the changes and make them one patch set.

Regards,
Michael Wang

> 
>> -	props->core_cap_flags = RDMA_CORE_CAP_PROT_IB;
>> +	props->core_cap_flags = RDMA_CORE_CAP_PROT_IB | RDMA_CORE_CAP_IB_MAD;
> 
> Hurm,
> 
> Maybe add some macros to help this out, document the standard that
> the port implements:
> 
> #define RDMA_CORE_PORT_IB_IBA_v1_2 (RDMA_CORE_CAP_PROT_IB | RDMA_CORE_CAP_IB_MAD)
> #define RDMA_CORE_PORT_ROCEE_IBA_v1_2_A15 ..
> #define RDMA_CORE_PORT_ROCEE_IBA_v1_3_A16 ..
> 
>>  static inline int cap_ib_mad(struct ib_device *device, u8 port_num)
>>  {
>> -	return rdma_ib_or_iboe(device, port_num);
>> +	return !!(device->core_cap_flags[port_num] & RDMA_CORE_CAP_IB_MAD);
> 
> 
> 'bool' is OK in the kernel, just use that instead of !! - in fact all of
> thse cap returns should return bool. Michael should fix that in his
> series too.
> 
> Jason
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/infiniband/hw/ehca/ehca_hca.c b/drivers/infiniband/hw/ehca/ehca_hca.c
index 75f5353..a06eadd 100644
--- a/drivers/infiniband/hw/ehca/ehca_hca.c
+++ b/drivers/infiniband/hw/ehca/ehca_hca.c
@@ -236,7 +236,7 @@  int ehca_query_port(struct ib_device *ibdev,
 		props->active_speed    = IB_SPEED_SDR;
 	}
 
-	props->core_cap_flags = RDMA_CORE_CAP_PROT_IB;
+	props->core_cap_flags = RDMA_CORE_CAP_PROT_IB | RDMA_CORE_CAP_IB_MAD;
 
 query_port1:
 	ehca_free_fw_ctrlblock(rblock);
diff --git a/drivers/infiniband/hw/ipath/ipath_verbs.c b/drivers/infiniband/hw/ipath/ipath_verbs.c
index 94a03eb..bb66aa7 100644
--- a/drivers/infiniband/hw/ipath/ipath_verbs.c
+++ b/drivers/infiniband/hw/ipath/ipath_verbs.c
@@ -1634,7 +1634,7 @@  static int ipath_query_port(struct ib_device *ibdev,
 	}
 	props->active_mtu = mtu;
 	props->subnet_timeout = dev->subnet_timeout;
-	props->core_cap_flags = RDMA_CORE_CAP_PROT_IB;
+	props->core_cap_flags = RDMA_CORE_CAP_PROT_IB | RDMA_CORE_CAP_IB_MAD;
 
 	return 0;
 }
diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c
index fa4e45c..9db5fdc 100644
--- a/drivers/infiniband/hw/mlx4/main.c
+++ b/drivers/infiniband/hw/mlx4/main.c
@@ -330,7 +330,7 @@  static int ib_link_query_port(struct ib_device *ibdev, u8 port,
 	if (props->state == IB_PORT_DOWN)
 		 props->active_speed = IB_SPEED_SDR;
 
-	props->core_cap_flags = RDMA_CORE_CAP_PROT_IB;
+	props->core_cap_flags = RDMA_CORE_CAP_PROT_IB | RDMA_CORE_CAP_IB_MAD;
 
 out:
 	kfree(in_mad);
@@ -392,7 +392,7 @@  static int eth_link_query_port(struct ib_device *ibdev, u8 port,
 	props->state		= (netif_running(ndev) && netif_carrier_ok(ndev)) ?
 					IB_PORT_ACTIVE : IB_PORT_DOWN;
 	props->phys_state	= state_to_phys_state(props->state);
-	props->core_cap_flags   = RDMA_CORE_CAP_PROT_IBOE;
+	props->core_cap_flags   = RDMA_CORE_CAP_PROT_IBOE | RDMA_CORE_CAP_IB_MAD;
 out_unlock:
 	spin_unlock_bh(&iboe->lock);
 	if (is_bonded)
diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
index e3cdc17..4b8ef01 100644
--- a/drivers/infiniband/hw/mlx5/main.c
+++ b/drivers/infiniband/hw/mlx5/main.c
@@ -255,7 +255,7 @@  int mlx5_ib_query_port(struct ib_device *ibdev, u8 port,
 		}
 	}
 
-	props->core_cap_flags   = RDMA_CORE_CAP_PROT_IB;
+	props->core_cap_flags   = RDMA_CORE_CAP_PROT_IB | RDMA_CORE_CAP_IB_MAD;
 
 out:
 	kfree(in_mad);
diff --git a/drivers/infiniband/hw/mthca/mthca_provider.c b/drivers/infiniband/hw/mthca/mthca_provider.c
index e49aece..60fcc02 100644
--- a/drivers/infiniband/hw/mthca/mthca_provider.c
+++ b/drivers/infiniband/hw/mthca/mthca_provider.c
@@ -172,7 +172,7 @@  static int mthca_query_port(struct ib_device *ibdev,
 	props->subnet_timeout    = out_mad->data[51] & 0x1f;
 	props->max_vl_num        = out_mad->data[37] >> 4;
 	props->init_type_reply   = out_mad->data[41] >> 4;
-	props->core_cap_flags    = RDMA_CORE_CAP_PROT_IB;
+	props->core_cap_flags    = RDMA_CORE_CAP_PROT_IB | RDMA_CORE_CAP_IB_MAD;
 
  out:
 	kfree(in_mad);
diff --git a/drivers/infiniband/hw/qib/qib_verbs.c b/drivers/infiniband/hw/qib/qib_verbs.c
index 6e52946..6975528 100644
--- a/drivers/infiniband/hw/qib/qib_verbs.c
+++ b/drivers/infiniband/hw/qib/qib_verbs.c
@@ -1646,7 +1646,7 @@  static int qib_query_port(struct ib_device *ibdev, u8 port,
 	}
 	props->active_mtu = mtu;
 	props->subnet_timeout = ibp->subnet_timeout;
-	props->core_cap_flags = RDMA_CORE_CAP_PROT_IB;
+	props->core_cap_flags = RDMA_CORE_CAP_PROT_IB | RDMA_CORE_CAP_IB_MAD;
 
 	return 0;
 }
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index dcaee4f..6c2b0e5 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -1807,7 +1807,7 @@  static inline int rdma_ib_or_iboe(struct ib_device *device, u8 port_num)
  */
 static inline int cap_ib_mad(struct ib_device *device, u8 port_num)
 {
-	return rdma_ib_or_iboe(device, port_num);
+	return !!(device->core_cap_flags[port_num] & RDMA_CORE_CAP_IB_MAD);
 }
 
 /**