diff mbox series

[rdma-core] libibverbs/examples: Add missing device attributes

Message ID 20220209025308.20743-1-yangx.jy@fujitsu.com (mailing list archive)
State Rejected
Headers show
Series [rdma-core] libibverbs/examples: Add missing device attributes | expand

Commit Message

Xiao Yang Feb. 9, 2022, 2:53 a.m. UTC
make ibv_devinfo command show more device attributes.

Signed-off-by: Xiao Yang <yangx.jy@fujitsu.com>
---
 libibverbs/examples/devinfo.c | 29 +++++++++++++++++++++++++----
 libibverbs/verbs.h            | 13 ++++++++++---
 2 files changed, 35 insertions(+), 7 deletions(-)

Comments

Leon Romanovsky Feb. 9, 2022, 8:59 a.m. UTC | #1
On Wed, Feb 09, 2022 at 10:53:08AM +0800, Xiao Yang wrote:
> make ibv_devinfo command show more device attributes.
> 
> Signed-off-by: Xiao Yang <yangx.jy@fujitsu.com>
> ---
>  libibverbs/examples/devinfo.c | 29 +++++++++++++++++++++++++----
>  libibverbs/verbs.h            | 13 ++++++++++---
>  2 files changed, 35 insertions(+), 7 deletions(-)

I have a feeling that a long time ago, we had a discussion if and how
expose device capabilities and the decision was that we don't report
in-kernel specific device caps.

Jason, do you remember anything like this?

Thanks

> 
> diff --git a/libibverbs/examples/devinfo.c b/libibverbs/examples/devinfo.c
> index cef6e2ea..8e889842 100644
> --- a/libibverbs/examples/devinfo.c
> +++ b/libibverbs/examples/devinfo.c
> @@ -267,7 +267,9 @@ static void print_device_cap_flags(uint32_t dev_cap_flags)
>  				   IBV_DEVICE_MEM_WINDOW_TYPE_2B |
>  				   IBV_DEVICE_RC_IP_CSUM |
>  				   IBV_DEVICE_RAW_IP_CSUM |
> -				   IBV_DEVICE_MANAGED_FLOW_STEERING);
> +				   IBV_DEVICE_CROSS_CHANNEL |
> +				   IBV_DEVICE_MANAGED_FLOW_STEERING |
> +				   IBV_DEVICE_INTEGRITY_HANDOVER);
>  
>  	if (dev_cap_flags & IBV_DEVICE_RESIZE_MAX_WR)
>  		printf("\t\t\t\t\tRESIZE_MAX_WR\n");
> @@ -315,8 +317,12 @@ static void print_device_cap_flags(uint32_t dev_cap_flags)
>  		printf("\t\t\t\t\tRC_IP_CSUM\n");
>  	if (dev_cap_flags & IBV_DEVICE_RAW_IP_CSUM)
>  		printf("\t\t\t\t\tRAW_IP_CSUM\n");
> +	if (dev_cap_flags & IBV_DEVICE_CROSS_CHANNEL)
> +		printf("\t\t\t\t\tCROSS_CHANNEL\n");
>  	if (dev_cap_flags & IBV_DEVICE_MANAGED_FLOW_STEERING)
>  		printf("\t\t\t\t\tMANAGED_FLOW_STEERING\n");
> +	if (dev_cap_flags & IBV_DEVICE_INTEGRITY_HANDOVER)
> +		printf("\t\t\t\t\tINTEGRITY_HANDOVER\n");
>  	if (dev_cap_flags & unknown_flags)
>  		printf("\t\t\t\t\tUnknown flags: 0x%" PRIX32 "\n",
>  		       dev_cap_flags & unknown_flags);
> @@ -382,13 +388,28 @@ static void print_odp_caps(const struct ibv_device_attr_ex *device_attr)
>  static void print_device_cap_flags_ex(uint64_t device_cap_flags_ex)
>  {
>  	uint64_t ex_flags = device_cap_flags_ex & 0xffffffff00000000ULL;
> -	uint64_t unknown_flags = ~(IBV_DEVICE_RAW_SCATTER_FCS |
> -				   IBV_DEVICE_PCI_WRITE_END_PADDING);
> -
> +	uint64_t unknown_flags = ~(IBV_DEVICE_ON_DEMAND_PAGING |
> +				   IBV_DEVICE_SG_GAPS_REG |
> +				   IBV_DEVICE_VIRTUAL_FUNCTION |
> +				   IBV_DEVICE_RAW_SCATTER_FCS |
> +				   IBV_DEVICE_RDMA_NETDEV_OPA |
> +				   IBV_DEVICE_PCI_WRITE_END_PADDING |
> +				   IBV_DEVICE_ALLOW_USER_UNREG);
> +
> +	if (ex_flags & IBV_DEVICE_ON_DEMAND_PAGING)
> +		printf("\t\t\t\t\tON_DEMAND_PAGING\n");
> +	if (ex_flags & IBV_DEVICE_SG_GAPS_REG)
> +		printf("\t\t\t\t\tSG_GAPS_REG\n");
> +	if (ex_flags & IBV_DEVICE_VIRTUAL_FUNCTION)
> +		printf("\t\t\t\t\tVIRTUAL_FUNCTION\n");
>  	if (ex_flags & IBV_DEVICE_RAW_SCATTER_FCS)
>  		printf("\t\t\t\t\tRAW_SCATTER_FCS\n");
> +	if (ex_flags & IBV_DEVICE_RDMA_NETDEV_OPA)
> +		printf("\t\t\t\t\tRDMA_NETDEV_OPA\n");
>  	if (ex_flags & IBV_DEVICE_PCI_WRITE_END_PADDING)
>  		printf("\t\t\t\t\tPCI_WRITE_END_PADDING\n");
> +	if (ex_flags & IBV_DEVICE_ALLOW_USER_UNREG)
> +		printf("\t\t\t\t\tALLOW_USER_UNREG\n");
>  	if (ex_flags & unknown_flags)
>  		printf("\t\t\t\t\tUnknown flags: 0x%" PRIX64 "\n",
>  		       ex_flags & unknown_flags);
> diff --git a/libibverbs/verbs.h b/libibverbs/verbs.h
> index a9f182ff..68591c7b 100644
> --- a/libibverbs/verbs.h
> +++ b/libibverbs/verbs.h
> @@ -136,7 +136,9 @@ enum ibv_device_cap_flags {
>  	IBV_DEVICE_MEM_WINDOW_TYPE_2B	= 1 << 24,
>  	IBV_DEVICE_RC_IP_CSUM		= 1 << 25,
>  	IBV_DEVICE_RAW_IP_CSUM		= 1 << 26,
> -	IBV_DEVICE_MANAGED_FLOW_STEERING = 1 << 29
> +	IBV_DEVICE_CROSS_CHANNEL	= 1 << 27,
> +	IBV_DEVICE_MANAGED_FLOW_STEERING = 1 << 29,
> +	IBV_DEVICE_INTEGRITY_HANDOVER	= 1 << 30
>  };
>  
>  enum ibv_fork_status {
> @@ -149,8 +151,13 @@ enum ibv_fork_status {
>   * Can't extended above ibv_device_cap_flags enum as in some systems/compilers
>   * enum range is limited to 4 bytes.
>   */
> -#define IBV_DEVICE_RAW_SCATTER_FCS (1ULL << 34)
> -#define IBV_DEVICE_PCI_WRITE_END_PADDING (1ULL << 36)
> +#define IBV_DEVICE_ON_DEMAND_PAGING		(1ULL << 31)
> +#define IBV_DEVICE_SG_GAPS_REG			(1ULL << 32)
> +#define IBV_DEVICE_VIRTUAL_FUNCTION		(1ULL << 33)
> +#define IBV_DEVICE_RAW_SCATTER_FCS		(1ULL << 34)
> +#define IBV_DEVICE_RDMA_NETDEV_OPA		(1ULL << 35)
> +#define IBV_DEVICE_PCI_WRITE_END_PADDING	(1ULL << 36)
> +#define IBV_DEVICE_ALLOW_USER_UNREG		(1ULL << 37)
>  
>  enum ibv_atomic_cap {
>  	IBV_ATOMIC_NONE,
> -- 
> 2.34.1
> 
> 
>
Jason Gunthorpe Feb. 11, 2022, 12:41 p.m. UTC | #2
On Wed, Feb 09, 2022 at 10:59:08AM +0200, Leon Romanovsky wrote:
> On Wed, Feb 09, 2022 at 10:53:08AM +0800, Xiao Yang wrote:
> > make ibv_devinfo command show more device attributes.
> > 
> > Signed-off-by: Xiao Yang <yangx.jy@fujitsu.com>
> >  libibverbs/examples/devinfo.c | 29 +++++++++++++++++++++++++----
> >  libibverbs/verbs.h            | 13 ++++++++++---
> >  2 files changed, 35 insertions(+), 7 deletions(-)
> 
> I have a feeling that a long time ago, we had a discussion if and how
> expose device capabilities and the decision was that we don't report
> in-kernel specific device caps.

Right, it is kernel bug they leak out in the first place.

> > diff --git a/libibverbs/verbs.h b/libibverbs/verbs.h
> > index a9f182ff..68591c7b 100644
> > +++ b/libibverbs/verbs.h
> > @@ -136,7 +136,9 @@ enum ibv_device_cap_flags {
> >  	IBV_DEVICE_MEM_WINDOW_TYPE_2B	= 1 << 24,
> >  	IBV_DEVICE_RC_IP_CSUM		= 1 << 25,
> >  	IBV_DEVICE_RAW_IP_CSUM		= 1 << 26,
> > -	IBV_DEVICE_MANAGED_FLOW_STEERING = 1 << 29
> > +	IBV_DEVICE_CROSS_CHANNEL	= 1 << 27,
> > +	IBV_DEVICE_MANAGED_FLOW_STEERING = 1 << 29,
> > +	IBV_DEVICE_INTEGRITY_HANDOVER	= 1 << 30
> >  };
> >  
> >  enum ibv_fork_status {
> > @@ -149,8 +151,13 @@ enum ibv_fork_status {
> >   * Can't extended above ibv_device_cap_flags enum as in some systems/compilers
> >   * enum range is limited to 4 bytes.
> >   */
> > -#define IBV_DEVICE_RAW_SCATTER_FCS (1ULL << 34)
> > -#define IBV_DEVICE_PCI_WRITE_END_PADDING (1ULL << 36)
> > +#define IBV_DEVICE_ON_DEMAND_PAGING		(1ULL << 31)
> > +#define IBV_DEVICE_SG_GAPS_REG			(1ULL << 32)
> > +#define IBV_DEVICE_VIRTUAL_FUNCTION		(1ULL << 33)
> > +#define IBV_DEVICE_RAW_SCATTER_FCS		(1ULL << 34)
> > +#define IBV_DEVICE_RDMA_NETDEV_OPA		(1ULL << 35)
> > +#define IBV_DEVICE_PCI_WRITE_END_PADDING	(1ULL << 36)
> > +#define IBV_DEVICE_ALLOW_USER_UNREG		(1ULL << 37)

And don't copy ABI into header like this, the kernel parts need to be
moved to the kernel uabi header and cleaned

Jason
Xiao Yang March 7, 2022, 10:03 a.m. UTC | #3
On 2022/2/11 20:41, Jason Gunthorpe wrote:
> On Wed, Feb 09, 2022 at 10:59:08AM +0200, Leon Romanovsky wrote:
>> On Wed, Feb 09, 2022 at 10:53:08AM +0800, Xiao Yang wrote:
>>> make ibv_devinfo command show more device attributes.
>>>
>>> Signed-off-by: Xiao Yang <yangx.jy@fujitsu.com>
>>>   libibverbs/examples/devinfo.c | 29 +++++++++++++++++++++++++----
>>>   libibverbs/verbs.h            | 13 ++++++++++---
>>>   2 files changed, 35 insertions(+), 7 deletions(-)
>> I have a feeling that a long time ago, we had a discussion if and how
>> expose device capabilities and the decision was that we don't report
>> in-kernel specific device caps.
> Right, it is kernel bug they leak out in the first place.
>
>>> diff --git a/libibverbs/verbs.h b/libibverbs/verbs.h
>>> index a9f182ff..68591c7b 100644
>>> +++ b/libibverbs/verbs.h
>>> @@ -136,7 +136,9 @@ enum ibv_device_cap_flags {
>>>   	IBV_DEVICE_MEM_WINDOW_TYPE_2B	= 1 << 24,
>>>   	IBV_DEVICE_RC_IP_CSUM		= 1 << 25,
>>>   	IBV_DEVICE_RAW_IP_CSUM		= 1 << 26,
>>> -	IBV_DEVICE_MANAGED_FLOW_STEERING = 1 << 29
>>> +	IBV_DEVICE_CROSS_CHANNEL	= 1 << 27,
>>> +	IBV_DEVICE_MANAGED_FLOW_STEERING = 1 << 29,
>>> +	IBV_DEVICE_INTEGRITY_HANDOVER	= 1 << 30
>>>   };
>>>   
>>>   enum ibv_fork_status {
>>> @@ -149,8 +151,13 @@ enum ibv_fork_status {
>>>    * Can't extended above ibv_device_cap_flags enum as in some systems/compilers
>>>    * enum range is limited to 4 bytes.
>>>    */
>>> -#define IBV_DEVICE_RAW_SCATTER_FCS (1ULL << 34)
>>> -#define IBV_DEVICE_PCI_WRITE_END_PADDING (1ULL << 36)
>>> +#define IBV_DEVICE_ON_DEMAND_PAGING		(1ULL << 31)
>>> +#define IBV_DEVICE_SG_GAPS_REG			(1ULL << 32)
>>> +#define IBV_DEVICE_VIRTUAL_FUNCTION		(1ULL << 33)
>>> +#define IBV_DEVICE_RAW_SCATTER_FCS		(1ULL << 34)
>>> +#define IBV_DEVICE_RDMA_NETDEV_OPA		(1ULL << 35)
>>> +#define IBV_DEVICE_PCI_WRITE_END_PADDING	(1ULL << 36)
>>> +#define IBV_DEVICE_ALLOW_USER_UNREG		(1ULL << 37)
> And don't copy ABI into header like this, the kernel parts need to be
> moved to the kernel uabi header and cleaned

Hi Jason, Leon

Sorry, it's not clear to me.

1) Is it necessary to add these missing attributes?

2) If necessary, do you think they need to be moved into 
kernel-headers/rdma?

Best Regards,

Xiao Yang

>
> Jason
Leon Romanovsky March 9, 2022, 1:20 p.m. UTC | #4
On Mon, Mar 07, 2022 at 10:03:25AM +0000, yangx.jy@fujitsu.com wrote:
> On 2022/2/11 20:41, Jason Gunthorpe wrote:
> > On Wed, Feb 09, 2022 at 10:59:08AM +0200, Leon Romanovsky wrote:
> >> On Wed, Feb 09, 2022 at 10:53:08AM +0800, Xiao Yang wrote:
> >>> make ibv_devinfo command show more device attributes.
> >>>
> >>> Signed-off-by: Xiao Yang <yangx.jy@fujitsu.com>
> >>>   libibverbs/examples/devinfo.c | 29 +++++++++++++++++++++++++----
> >>>   libibverbs/verbs.h            | 13 ++++++++++---
> >>>   2 files changed, 35 insertions(+), 7 deletions(-)
> >> I have a feeling that a long time ago, we had a discussion if and how
> >> expose device capabilities and the decision was that we don't report
> >> in-kernel specific device caps.
> > Right, it is kernel bug they leak out in the first place.
> >
> >>> diff --git a/libibverbs/verbs.h b/libibverbs/verbs.h
> >>> index a9f182ff..68591c7b 100644
> >>> +++ b/libibverbs/verbs.h
> >>> @@ -136,7 +136,9 @@ enum ibv_device_cap_flags {
> >>>   	IBV_DEVICE_MEM_WINDOW_TYPE_2B	= 1 << 24,
> >>>   	IBV_DEVICE_RC_IP_CSUM		= 1 << 25,
> >>>   	IBV_DEVICE_RAW_IP_CSUM		= 1 << 26,
> >>> -	IBV_DEVICE_MANAGED_FLOW_STEERING = 1 << 29
> >>> +	IBV_DEVICE_CROSS_CHANNEL	= 1 << 27,
> >>> +	IBV_DEVICE_MANAGED_FLOW_STEERING = 1 << 29,
> >>> +	IBV_DEVICE_INTEGRITY_HANDOVER	= 1 << 30
> >>>   };
> >>>   
> >>>   enum ibv_fork_status {
> >>> @@ -149,8 +151,13 @@ enum ibv_fork_status {
> >>>    * Can't extended above ibv_device_cap_flags enum as in some systems/compilers
> >>>    * enum range is limited to 4 bytes.
> >>>    */
> >>> -#define IBV_DEVICE_RAW_SCATTER_FCS (1ULL << 34)
> >>> -#define IBV_DEVICE_PCI_WRITE_END_PADDING (1ULL << 36)
> >>> +#define IBV_DEVICE_ON_DEMAND_PAGING		(1ULL << 31)
> >>> +#define IBV_DEVICE_SG_GAPS_REG			(1ULL << 32)
> >>> +#define IBV_DEVICE_VIRTUAL_FUNCTION		(1ULL << 33)
> >>> +#define IBV_DEVICE_RAW_SCATTER_FCS		(1ULL << 34)
> >>> +#define IBV_DEVICE_RDMA_NETDEV_OPA		(1ULL << 35)
> >>> +#define IBV_DEVICE_PCI_WRITE_END_PADDING	(1ULL << 36)
> >>> +#define IBV_DEVICE_ALLOW_USER_UNREG		(1ULL << 37)
> > And don't copy ABI into header like this, the kernel parts need to be
> > moved to the kernel uabi header and cleaned
> 
> Hi Jason, Leon
> 
> Sorry, it's not clear to me.
> 
> 1) Is it necessary to add these missing attributes?
> 
> 2) If necessary, do you think they need to be moved into 
> kernel-headers/rdma?

We wanted to say that these device supported capabilities shouldn't be
added to ibv_devinfo.

Thanks

> 
> Best Regards,
> 
> Xiao Yang
> 
> >
> > Jason
diff mbox series

Patch

diff --git a/libibverbs/examples/devinfo.c b/libibverbs/examples/devinfo.c
index cef6e2ea..8e889842 100644
--- a/libibverbs/examples/devinfo.c
+++ b/libibverbs/examples/devinfo.c
@@ -267,7 +267,9 @@  static void print_device_cap_flags(uint32_t dev_cap_flags)
 				   IBV_DEVICE_MEM_WINDOW_TYPE_2B |
 				   IBV_DEVICE_RC_IP_CSUM |
 				   IBV_DEVICE_RAW_IP_CSUM |
-				   IBV_DEVICE_MANAGED_FLOW_STEERING);
+				   IBV_DEVICE_CROSS_CHANNEL |
+				   IBV_DEVICE_MANAGED_FLOW_STEERING |
+				   IBV_DEVICE_INTEGRITY_HANDOVER);
 
 	if (dev_cap_flags & IBV_DEVICE_RESIZE_MAX_WR)
 		printf("\t\t\t\t\tRESIZE_MAX_WR\n");
@@ -315,8 +317,12 @@  static void print_device_cap_flags(uint32_t dev_cap_flags)
 		printf("\t\t\t\t\tRC_IP_CSUM\n");
 	if (dev_cap_flags & IBV_DEVICE_RAW_IP_CSUM)
 		printf("\t\t\t\t\tRAW_IP_CSUM\n");
+	if (dev_cap_flags & IBV_DEVICE_CROSS_CHANNEL)
+		printf("\t\t\t\t\tCROSS_CHANNEL\n");
 	if (dev_cap_flags & IBV_DEVICE_MANAGED_FLOW_STEERING)
 		printf("\t\t\t\t\tMANAGED_FLOW_STEERING\n");
+	if (dev_cap_flags & IBV_DEVICE_INTEGRITY_HANDOVER)
+		printf("\t\t\t\t\tINTEGRITY_HANDOVER\n");
 	if (dev_cap_flags & unknown_flags)
 		printf("\t\t\t\t\tUnknown flags: 0x%" PRIX32 "\n",
 		       dev_cap_flags & unknown_flags);
@@ -382,13 +388,28 @@  static void print_odp_caps(const struct ibv_device_attr_ex *device_attr)
 static void print_device_cap_flags_ex(uint64_t device_cap_flags_ex)
 {
 	uint64_t ex_flags = device_cap_flags_ex & 0xffffffff00000000ULL;
-	uint64_t unknown_flags = ~(IBV_DEVICE_RAW_SCATTER_FCS |
-				   IBV_DEVICE_PCI_WRITE_END_PADDING);
-
+	uint64_t unknown_flags = ~(IBV_DEVICE_ON_DEMAND_PAGING |
+				   IBV_DEVICE_SG_GAPS_REG |
+				   IBV_DEVICE_VIRTUAL_FUNCTION |
+				   IBV_DEVICE_RAW_SCATTER_FCS |
+				   IBV_DEVICE_RDMA_NETDEV_OPA |
+				   IBV_DEVICE_PCI_WRITE_END_PADDING |
+				   IBV_DEVICE_ALLOW_USER_UNREG);
+
+	if (ex_flags & IBV_DEVICE_ON_DEMAND_PAGING)
+		printf("\t\t\t\t\tON_DEMAND_PAGING\n");
+	if (ex_flags & IBV_DEVICE_SG_GAPS_REG)
+		printf("\t\t\t\t\tSG_GAPS_REG\n");
+	if (ex_flags & IBV_DEVICE_VIRTUAL_FUNCTION)
+		printf("\t\t\t\t\tVIRTUAL_FUNCTION\n");
 	if (ex_flags & IBV_DEVICE_RAW_SCATTER_FCS)
 		printf("\t\t\t\t\tRAW_SCATTER_FCS\n");
+	if (ex_flags & IBV_DEVICE_RDMA_NETDEV_OPA)
+		printf("\t\t\t\t\tRDMA_NETDEV_OPA\n");
 	if (ex_flags & IBV_DEVICE_PCI_WRITE_END_PADDING)
 		printf("\t\t\t\t\tPCI_WRITE_END_PADDING\n");
+	if (ex_flags & IBV_DEVICE_ALLOW_USER_UNREG)
+		printf("\t\t\t\t\tALLOW_USER_UNREG\n");
 	if (ex_flags & unknown_flags)
 		printf("\t\t\t\t\tUnknown flags: 0x%" PRIX64 "\n",
 		       ex_flags & unknown_flags);
diff --git a/libibverbs/verbs.h b/libibverbs/verbs.h
index a9f182ff..68591c7b 100644
--- a/libibverbs/verbs.h
+++ b/libibverbs/verbs.h
@@ -136,7 +136,9 @@  enum ibv_device_cap_flags {
 	IBV_DEVICE_MEM_WINDOW_TYPE_2B	= 1 << 24,
 	IBV_DEVICE_RC_IP_CSUM		= 1 << 25,
 	IBV_DEVICE_RAW_IP_CSUM		= 1 << 26,
-	IBV_DEVICE_MANAGED_FLOW_STEERING = 1 << 29
+	IBV_DEVICE_CROSS_CHANNEL	= 1 << 27,
+	IBV_DEVICE_MANAGED_FLOW_STEERING = 1 << 29,
+	IBV_DEVICE_INTEGRITY_HANDOVER	= 1 << 30
 };
 
 enum ibv_fork_status {
@@ -149,8 +151,13 @@  enum ibv_fork_status {
  * Can't extended above ibv_device_cap_flags enum as in some systems/compilers
  * enum range is limited to 4 bytes.
  */
-#define IBV_DEVICE_RAW_SCATTER_FCS (1ULL << 34)
-#define IBV_DEVICE_PCI_WRITE_END_PADDING (1ULL << 36)
+#define IBV_DEVICE_ON_DEMAND_PAGING		(1ULL << 31)
+#define IBV_DEVICE_SG_GAPS_REG			(1ULL << 32)
+#define IBV_DEVICE_VIRTUAL_FUNCTION		(1ULL << 33)
+#define IBV_DEVICE_RAW_SCATTER_FCS		(1ULL << 34)
+#define IBV_DEVICE_RDMA_NETDEV_OPA		(1ULL << 35)
+#define IBV_DEVICE_PCI_WRITE_END_PADDING	(1ULL << 36)
+#define IBV_DEVICE_ALLOW_USER_UNREG		(1ULL << 37)
 
 enum ibv_atomic_cap {
 	IBV_ATOMIC_NONE,