* [PATCH] rdma-core: define link speed and link width enums
@ 2017-05-08 13:44 Devesh Sharma
[not found] ` <1494251057-1060-1-git-send-email-devesh.sharma-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
0 siblings, 1 reply; 9+ messages in thread
From: Devesh Sharma @ 2017-05-08 13:44 UTC (permalink / raw)
To: linux-rdma-u79uwXL29TY76Z2rM5mHXA; +Cc: Devesh Sharma
Currently application either need to define its own enum
values for link-speed and link-width or use hard coded
values. This patch inharits the enums from kernel space
ib_verbs.h and puts into verbs.h for ease of programming.
Signed-off-by: Devesh Sharma <devesh.sharma-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
---
libibverbs/examples/devinfo.c | 22 ++++++++++++----------
libibverbs/verbs.h | 18 ++++++++++++++++++
2 files changed, 30 insertions(+), 10 deletions(-)
diff --git a/libibverbs/examples/devinfo.c b/libibverbs/examples/devinfo.c
index 2c1e3f1..42ed50c 100644
--- a/libibverbs/examples/devinfo.c
+++ b/libibverbs/examples/devinfo.c
@@ -124,10 +124,10 @@ static const char *mtu_str(enum ibv_mtu max_mtu)
static const char *width_str(uint8_t width)
{
switch (width) {
- case 1: return "1";
- case 2: return "4";
- case 4: return "8";
- case 8: return "12";
+ case IBV_WIDTH_1X: return "1";
+ case IBV_WIDTH_4X: return "4";
+ case IBV_WIDTH_8X: return "8";
+ case IBV_WIDTH_12X: return "12";
default: return "invalid width";
}
}
@@ -135,14 +135,16 @@ static const char *width_str(uint8_t width)
static const char *speed_str(uint8_t speed)
{
switch (speed) {
- case 1: return "2.5 Gbps";
- case 2: return "5.0 Gbps";
+ case IBV_SPEED_SDR: return "2.5 Gbps";
+ case IBV_SPEED_DDR: return "5.0 Gbps";
- case 4: /* fall through */
- case 8: return "10.0 Gbps";
+ case IBV_SPEED_QDR: /* fall through */
+ case IBV_SPEED_FDR10: return "10.0 Gbps";
- case 16: return "14.0 Gbps";
- case 32: return "25.0 Gbps";
+ case IBV_SPEED_FDR: return "14.0 Gbps";
+ case IBV_SPEED_EDR: return "25.0 Gbps";
+ case IBV_SPEED_HDR: return "50.0 Gbps";
+ case IBV_SPEE_NDR: return "100.0 Gbps";
default: return "invalid speed";
}
}
diff --git a/libibverbs/verbs.h b/libibverbs/verbs.h
index b27dfd1..39a65fe 100644
--- a/libibverbs/verbs.h
+++ b/libibverbs/verbs.h
@@ -290,6 +290,24 @@ enum ibv_port_state {
IBV_PORT_ACTIVE_DEFER = 5
};
+enum ibv_port_speed {
+ IBV_SPEED_SDR = 1,
+ IBV_SPEED_DDR = 2,
+ IBV_SPEED_QDR = 4,
+ IBV_SPEED_FDR10 = 8,
+ IBV_SPEED_FDR = 16,
+ IBV_SPEED_EDR = 32,
+ IBV_SPEED_HDR = 64,
+ IBV_SPEED_NDR = 128
+};
+
+enum ibv_port_width {
+ IBV_WIDTH_1X = 1,
+ IBV_WIDTH_4X = 2,
+ IBV_WIDTH_8X = 4,
+ IBV_WIDTH_12X = 8
+};
+
enum {
IBV_LINK_LAYER_UNSPECIFIED,
IBV_LINK_LAYER_INFINIBAND,
--
1.8.3.1
--
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
^ permalink raw reply related [flat|nested] 9+ messages in thread[parent not found: <1494251057-1060-1-git-send-email-devesh.sharma-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>]
* Re: [PATCH] rdma-core: define link speed and link width enums [not found] ` <1494251057-1060-1-git-send-email-devesh.sharma-dY08KVG/lbpWk0Htik3J/w@public.gmane.org> @ 2017-05-08 13:54 ` Leon Romanovsky [not found] ` <20170508135404.GD10073-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org> 2017-05-08 13:54 ` Hal Rosenstock 1 sibling, 1 reply; 9+ messages in thread From: Leon Romanovsky @ 2017-05-08 13:54 UTC (permalink / raw) To: Devesh Sharma; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA [-- Attachment #1: Type: text/plain, Size: 3038 bytes --] On Mon, May 08, 2017 at 09:44:17AM -0400, Devesh Sharma wrote: > Currently application either need to define its own enum > values for link-speed and link-width or use hard coded > values. This patch inharits the enums from kernel space > ib_verbs.h and puts into verbs.h for ease of programming. > > Signed-off-by: Devesh Sharma <devesh.sharma-dY08KVG/lbpWk0Htik3J/w@public.gmane.org> > --- > libibverbs/examples/devinfo.c | 22 ++++++++++++---------- > libibverbs/verbs.h | 18 ++++++++++++++++++ > 2 files changed, 30 insertions(+), 10 deletions(-) I think the better approach will be move these defines from include/rdma/ib_verbs.h to include/uapi/rdma/ib_user_verbs.h and reuse ib_user_verbs.h file directly in libibverbs. > > diff --git a/libibverbs/examples/devinfo.c b/libibverbs/examples/devinfo.c > index 2c1e3f1..42ed50c 100644 > --- a/libibverbs/examples/devinfo.c > +++ b/libibverbs/examples/devinfo.c > @@ -124,10 +124,10 @@ static const char *mtu_str(enum ibv_mtu max_mtu) > static const char *width_str(uint8_t width) > { > switch (width) { > - case 1: return "1"; > - case 2: return "4"; > - case 4: return "8"; > - case 8: return "12"; > + case IBV_WIDTH_1X: return "1"; > + case IBV_WIDTH_4X: return "4"; > + case IBV_WIDTH_8X: return "8"; > + case IBV_WIDTH_12X: return "12"; > default: return "invalid width"; > } > } > @@ -135,14 +135,16 @@ static const char *width_str(uint8_t width) > static const char *speed_str(uint8_t speed) > { > switch (speed) { > - case 1: return "2.5 Gbps"; > - case 2: return "5.0 Gbps"; > + case IBV_SPEED_SDR: return "2.5 Gbps"; > + case IBV_SPEED_DDR: return "5.0 Gbps"; > > - case 4: /* fall through */ > - case 8: return "10.0 Gbps"; > + case IBV_SPEED_QDR: /* fall through */ > + case IBV_SPEED_FDR10: return "10.0 Gbps"; > > - case 16: return "14.0 Gbps"; > - case 32: return "25.0 Gbps"; > + case IBV_SPEED_FDR: return "14.0 Gbps"; > + case IBV_SPEED_EDR: return "25.0 Gbps"; > + case IBV_SPEED_HDR: return "50.0 Gbps"; > + case IBV_SPEE_NDR: return "100.0 Gbps"; > default: return "invalid speed"; > } > } > diff --git a/libibverbs/verbs.h b/libibverbs/verbs.h > index b27dfd1..39a65fe 100644 > --- a/libibverbs/verbs.h > +++ b/libibverbs/verbs.h > @@ -290,6 +290,24 @@ enum ibv_port_state { > IBV_PORT_ACTIVE_DEFER = 5 > }; > > +enum ibv_port_speed { > + IBV_SPEED_SDR = 1, > + IBV_SPEED_DDR = 2, > + IBV_SPEED_QDR = 4, > + IBV_SPEED_FDR10 = 8, > + IBV_SPEED_FDR = 16, > + IBV_SPEED_EDR = 32, > + IBV_SPEED_HDR = 64, > + IBV_SPEED_NDR = 128 > +}; > + > +enum ibv_port_width { > + IBV_WIDTH_1X = 1, > + IBV_WIDTH_4X = 2, > + IBV_WIDTH_8X = 4, > + IBV_WIDTH_12X = 8 > +}; > + > enum { > IBV_LINK_LAYER_UNSPECIFIED, > IBV_LINK_LAYER_INFINIBAND, > -- > 1.8.3.1 > > -- > 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 [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 833 bytes --] ^ permalink raw reply [flat|nested] 9+ messages in thread
[parent not found: <20170508135404.GD10073-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>]
* Re: [PATCH] rdma-core: define link speed and link width enums [not found] ` <20170508135404.GD10073-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org> @ 2017-05-08 14:05 ` Dennis Dalessandro [not found] ` <e66a9fca-c6b3-ef6e-98b9-08d39bcc72d9-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> 0 siblings, 1 reply; 9+ messages in thread From: Dennis Dalessandro @ 2017-05-08 14:05 UTC (permalink / raw) To: Leon Romanovsky, Devesh Sharma; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA On 05/08/2017 09:54 AM, Leon Romanovsky wrote: > On Mon, May 08, 2017 at 09:44:17AM -0400, Devesh Sharma wrote: >> Currently application either need to define its own enum >> values for link-speed and link-width or use hard coded >> values. This patch inharits the enums from kernel space >> ib_verbs.h and puts into verbs.h for ease of programming. >> >> Signed-off-by: Devesh Sharma <devesh.sharma-dY08KVG/lbpWk0Htik3J/w@public.gmane.org> >> --- >> libibverbs/examples/devinfo.c | 22 ++++++++++++---------- >> libibverbs/verbs.h | 18 ++++++++++++++++++ >> 2 files changed, 30 insertions(+), 10 deletions(-) > > I think the better approach will be move these defines from > include/rdma/ib_verbs.h to include/uapi/rdma/ib_user_verbs.h > and reuse ib_user_verbs.h file directly in libibverbs. I agree on this. Please put this stuff in the uapi header file and include that in user space. -Denny -- 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 ^ permalink raw reply [flat|nested] 9+ messages in thread
[parent not found: <e66a9fca-c6b3-ef6e-98b9-08d39bcc72d9-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>]
* Re: [PATCH] rdma-core: define link speed and link width enums [not found] ` <e66a9fca-c6b3-ef6e-98b9-08d39bcc72d9-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> @ 2017-05-08 14:47 ` Devesh Sharma [not found] ` <CANjDDBgeoiayNScofG=4CFUNbbqmizbvgtpWSHXcPqhatRSQoA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 0 siblings, 1 reply; 9+ messages in thread From: Devesh Sharma @ 2017-05-08 14:47 UTC (permalink / raw) To: Dennis Dalessandro; +Cc: Leon Romanovsky, linux-rdma On Mon, May 8, 2017 at 7:35 PM, Dennis Dalessandro <dennis.dalessandro-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> wrote: > On 05/08/2017 09:54 AM, Leon Romanovsky wrote: >> >> On Mon, May 08, 2017 at 09:44:17AM -0400, Devesh Sharma wrote: >>> >>> Currently application either need to define its own enum >>> values for link-speed and link-width or use hard coded >>> values. This patch inharits the enums from kernel space >>> ib_verbs.h and puts into verbs.h for ease of programming. >>> >>> Signed-off-by: Devesh Sharma <devesh.sharma-dY08KVG/lbpWk0Htik3J/w@public.gmane.org> >>> --- >>> libibverbs/examples/devinfo.c | 22 ++++++++++++---------- >>> libibverbs/verbs.h | 18 ++++++++++++++++++ >>> 2 files changed, 30 insertions(+), 10 deletions(-) >> >> >> I think the better approach will be move these defines from >> include/rdma/ib_verbs.h to include/uapi/rdma/ib_user_verbs.h >> and reuse ib_user_verbs.h file directly in libibverbs. > > > I agree on this. Please put this stuff in the uapi header file and include > that in user space. Done, will post a V1 with 2 patches... > > -Denny -- 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 ^ permalink raw reply [flat|nested] 9+ messages in thread
[parent not found: <CANjDDBgeoiayNScofG=4CFUNbbqmizbvgtpWSHXcPqhatRSQoA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* Re: [PATCH] rdma-core: define link speed and link width enums [not found] ` <CANjDDBgeoiayNScofG=4CFUNbbqmizbvgtpWSHXcPqhatRSQoA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2017-05-08 16:12 ` Jason Gunthorpe [not found] ` <20170508161212.GA18125-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org> 0 siblings, 1 reply; 9+ messages in thread From: Jason Gunthorpe @ 2017-05-08 16:12 UTC (permalink / raw) To: Devesh Sharma; +Cc: Dennis Dalessandro, Leon Romanovsky, linux-rdma On Mon, May 08, 2017 at 08:17:06PM +0530, Devesh Sharma wrote: > On Mon, May 8, 2017 at 7:35 PM, Dennis Dalessandro > <dennis.dalessandro-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> wrote: > > On 05/08/2017 09:54 AM, Leon Romanovsky wrote: > >> > >> On Mon, May 08, 2017 at 09:44:17AM -0400, Devesh Sharma wrote: > >>> > >>> Currently application either need to define its own enum > >>> values for link-speed and link-width or use hard coded > >>> values. This patch inharits the enums from kernel space > >>> ib_verbs.h and puts into verbs.h for ease of programming. > >>> > >>> Signed-off-by: Devesh Sharma <devesh.sharma-dY08KVG/lbpWk0Htik3J/w@public.gmane.org> > >>> libibverbs/examples/devinfo.c | 22 ++++++++++++---------- > >>> libibverbs/verbs.h | 18 ++++++++++++++++++ > >>> 2 files changed, 30 insertions(+), 10 deletions(-) > >> > >> > >> I think the better approach will be move these defines from > >> include/rdma/ib_verbs.h to include/uapi/rdma/ib_user_verbs.h > >> and reuse ib_user_verbs.h file directly in libibverbs. > > > > > > I agree on this. Please put this stuff in the uapi header file and include > > that in user space. > > Done, will post a V1 with 2 patches... Relying on the kernel header from a uapi header means that we now require the distro to have a sufficient version of that kernel header. This might be OK, but you have to check to see what distros are including (cbuild --run-shell can help with this) Further, I seem to recall last time I lookd at this that using the kernel header was hard because there were lots of name conflicts that had to be resolved first. It would be great to see that done of course.. Jason -- 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 ^ permalink raw reply [flat|nested] 9+ messages in thread
[parent not found: <20170508161212.GA18125-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>]
* Re: [PATCH] rdma-core: define link speed and link width enums [not found] ` <20170508161212.GA18125-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org> @ 2017-05-08 17:00 ` Devesh Sharma [not found] ` <CANjDDBjDwuL8dn4ACkeGw-bBge6_fhFN5DqSAK6h0SPBGeds+Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 0 siblings, 1 reply; 9+ messages in thread From: Devesh Sharma @ 2017-05-08 17:00 UTC (permalink / raw) To: Jason Gunthorpe; +Cc: Dennis Dalessandro, Leon Romanovsky, linux-rdma On Mon, May 8, 2017 at 9:42 PM, Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org> wrote: > On Mon, May 08, 2017 at 08:17:06PM +0530, Devesh Sharma wrote: >> On Mon, May 8, 2017 at 7:35 PM, Dennis Dalessandro >> <dennis.dalessandro-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> wrote: >> > On 05/08/2017 09:54 AM, Leon Romanovsky wrote: >> >> >> >> On Mon, May 08, 2017 at 09:44:17AM -0400, Devesh Sharma wrote: >> >>> >> >>> Currently application either need to define its own enum >> >>> values for link-speed and link-width or use hard coded >> >>> values. This patch inharits the enums from kernel space >> >>> ib_verbs.h and puts into verbs.h for ease of programming. >> >>> >> >>> Signed-off-by: Devesh Sharma <devesh.sharma-dY08KVG/lbpWk0Htik3J/w@public.gmane.org> >> >>> libibverbs/examples/devinfo.c | 22 ++++++++++++---------- >> >>> libibverbs/verbs.h | 18 ++++++++++++++++++ >> >>> 2 files changed, 30 insertions(+), 10 deletions(-) >> >> >> >> >> >> I think the better approach will be move these defines from >> >> include/rdma/ib_verbs.h to include/uapi/rdma/ib_user_verbs.h >> >> and reuse ib_user_verbs.h file directly in libibverbs. >> > >> > >> > I agree on this. Please put this stuff in the uapi header file and include >> > that in user space. >> >> Done, will post a V1 with 2 patches... > > Relying on the kernel header from a uapi header means that we now > require the distro to have a sufficient version of that kernel header. Which means we need to have a mechanism to track the versions. is relying on the ABI version is good enough or you see any blockers there.. > > This might be OK, but you have to check to see what distros are > including (cbuild --run-shell can help with this) And if a given distro is not including then fall-back to current scheme, is it okay to have defining/un-defining compile time macros to enable/disable certain code sections? > > Further, I seem to recall last time I lookd at this that using the > kernel header was hard because there were lots of name conflicts > that had to be resolved first. It would be great to see that done of > course.. Thanks for the heads-up, I am still trying to understand the complete problem, reviewing what we have currently I will get back if there are any questions. > > Jason -- 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 ^ permalink raw reply [flat|nested] 9+ messages in thread
[parent not found: <CANjDDBjDwuL8dn4ACkeGw-bBge6_fhFN5DqSAK6h0SPBGeds+Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* Re: [PATCH] rdma-core: define link speed and link width enums [not found] ` <CANjDDBjDwuL8dn4ACkeGw-bBge6_fhFN5DqSAK6h0SPBGeds+Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2017-05-08 17:13 ` Jason Gunthorpe 0 siblings, 0 replies; 9+ messages in thread From: Jason Gunthorpe @ 2017-05-08 17:13 UTC (permalink / raw) To: Devesh Sharma; +Cc: Dennis Dalessandro, Leon Romanovsky, linux-rdma On Mon, May 08, 2017 at 10:30:29PM +0530, Devesh Sharma wrote: > > Relying on the kernel header from a uapi header means that we now > > require the distro to have a sufficient version of that kernel header. > Which means we need to have a mechanism to track the versions. > is relying on the ABI version is good enough or you see any blockers > there.. Realistically I think it means those distros will have to be de-supported. This might not be a problem, the uapi headers are fairly old now, you'll have to check.. If something really old like rhel6 has what you need then things are OK. > > This might be OK, but you have to check to see what distros are > > including (cbuild --run-shell can help with this) > And if a given distro is not including then fall-back to current > scheme, is it okay to have defining/un-defining compile time macros > to enable/disable certain code sections? No, generally not. This is too hard to do safely in public headers.. Jason -- 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 ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] rdma-core: define link speed and link width enums [not found] ` <1494251057-1060-1-git-send-email-devesh.sharma-dY08KVG/lbpWk0Htik3J/w@public.gmane.org> 2017-05-08 13:54 ` Leon Romanovsky @ 2017-05-08 13:54 ` Hal Rosenstock [not found] ` <de4b2ea7-9613-80c6-b4a1-288f5c5bedcd-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org> 1 sibling, 1 reply; 9+ messages in thread From: Hal Rosenstock @ 2017-05-08 13:54 UTC (permalink / raw) To: Devesh Sharma, linux-rdma-u79uwXL29TY76Z2rM5mHXA On 5/8/2017 9:44 AM, Devesh Sharma wrote: > Currently application either need to define its own enum > values for link-speed and link-width or use hard coded > values. This patch inharits the enums from kernel space > ib_verbs.h and puts into verbs.h for ease of programming. > > Signed-off-by: Devesh Sharma <devesh.sharma-dY08KVG/lbpWk0Htik3J/w@public.gmane.org> > --- > libibverbs/examples/devinfo.c | 22 ++++++++++++---------- > libibverbs/verbs.h | 18 ++++++++++++++++++ > 2 files changed, 30 insertions(+), 10 deletions(-) > > diff --git a/libibverbs/examples/devinfo.c b/libibverbs/examples/devinfo.c > index 2c1e3f1..42ed50c 100644 > --- a/libibverbs/examples/devinfo.c > +++ b/libibverbs/examples/devinfo.c > @@ -124,10 +124,10 @@ static const char *mtu_str(enum ibv_mtu max_mtu) > static const char *width_str(uint8_t width) > { > switch (width) { > - case 1: return "1"; > - case 2: return "4"; > - case 4: return "8"; > - case 8: return "12"; > + case IBV_WIDTH_1X: return "1"; > + case IBV_WIDTH_4X: return "4"; > + case IBV_WIDTH_8X: return "8"; > + case IBV_WIDTH_12X: return "12"; > default: return "invalid width"; > } > } > @@ -135,14 +135,16 @@ static const char *width_str(uint8_t width) > static const char *speed_str(uint8_t speed) > { > switch (speed) { > - case 1: return "2.5 Gbps"; > - case 2: return "5.0 Gbps"; > + case IBV_SPEED_SDR: return "2.5 Gbps"; > + case IBV_SPEED_DDR: return "5.0 Gbps"; > > - case 4: /* fall through */ > - case 8: return "10.0 Gbps"; > + case IBV_SPEED_QDR: /* fall through */ > + case IBV_SPEED_FDR10: return "10.0 Gbps"; > > - case 16: return "14.0 Gbps"; > - case 32: return "25.0 Gbps"; > + case IBV_SPEED_FDR: return "14.0 Gbps"; > + case IBV_SPEED_EDR: return "25.0 Gbps"; > + case IBV_SPEED_HDR: return "50.0 Gbps"; > + case IBV_SPEE_NDR: return "100.0 Gbps"; typo > default: return "invalid speed"; > } > } > diff --git a/libibverbs/verbs.h b/libibverbs/verbs.h > index b27dfd1..39a65fe 100644 > --- a/libibverbs/verbs.h > +++ b/libibverbs/verbs.h > @@ -290,6 +290,24 @@ enum ibv_port_state { > IBV_PORT_ACTIVE_DEFER = 5 > }; > > +enum ibv_port_speed { > + IBV_SPEED_SDR = 1, > + IBV_SPEED_DDR = 2, > + IBV_SPEED_QDR = 4, > + IBV_SPEED_FDR10 = 8, > + IBV_SPEED_FDR = 16, > + IBV_SPEED_EDR = 32, > + IBV_SPEED_HDR = 64, > + IBV_SPEED_NDR = 128 HDR is almost defined now but NDR is not. Is it premature to put in NDR now ? Also, if either of these are being added, should 2x also be added ? -- Hal > +}; > + > +enum ibv_port_width { > + IBV_WIDTH_1X = 1, > + IBV_WIDTH_4X = 2, > + IBV_WIDTH_8X = 4, > + IBV_WIDTH_12X = 8 > +}; > + > enum { > IBV_LINK_LAYER_UNSPECIFIED, > IBV_LINK_LAYER_INFINIBAND, > -- 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 ^ permalink raw reply [flat|nested] 9+ messages in thread
[parent not found: <de4b2ea7-9613-80c6-b4a1-288f5c5bedcd-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>]
* Re: [PATCH] rdma-core: define link speed and link width enums [not found] ` <de4b2ea7-9613-80c6-b4a1-288f5c5bedcd-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org> @ 2017-05-08 14:39 ` Devesh Sharma 0 siblings, 0 replies; 9+ messages in thread From: Devesh Sharma @ 2017-05-08 14:39 UTC (permalink / raw) To: Hal Rosenstock; +Cc: linux-rdma On Mon, May 8, 2017 at 7:24 PM, Hal Rosenstock <hal-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org> wrote: > On 5/8/2017 9:44 AM, Devesh Sharma wrote: >> Currently application either need to define its own enum >> values for link-speed and link-width or use hard coded >> values. This patch inharits the enums from kernel space >> ib_verbs.h and puts into verbs.h for ease of programming. >> >> Signed-off-by: Devesh Sharma <devesh.sharma-dY08KVG/lbpWk0Htik3J/w@public.gmane.org> >> --- >> libibverbs/examples/devinfo.c | 22 ++++++++++++---------- >> libibverbs/verbs.h | 18 ++++++++++++++++++ >> 2 files changed, 30 insertions(+), 10 deletions(-) >> >> diff --git a/libibverbs/examples/devinfo.c b/libibverbs/examples/devinfo.c >> index 2c1e3f1..42ed50c 100644 >> --- a/libibverbs/examples/devinfo.c >> +++ b/libibverbs/examples/devinfo.c >> @@ -124,10 +124,10 @@ static const char *mtu_str(enum ibv_mtu max_mtu) >> static const char *width_str(uint8_t width) >> { >> switch (width) { >> - case 1: return "1"; >> - case 2: return "4"; >> - case 4: return "8"; >> - case 8: return "12"; >> + case IBV_WIDTH_1X: return "1"; >> + case IBV_WIDTH_4X: return "4"; >> + case IBV_WIDTH_8X: return "8"; >> + case IBV_WIDTH_12X: return "12"; >> default: return "invalid width"; >> } >> } >> @@ -135,14 +135,16 @@ static const char *width_str(uint8_t width) >> static const char *speed_str(uint8_t speed) >> { >> switch (speed) { >> - case 1: return "2.5 Gbps"; >> - case 2: return "5.0 Gbps"; >> + case IBV_SPEED_SDR: return "2.5 Gbps"; >> + case IBV_SPEED_DDR: return "5.0 Gbps"; >> >> - case 4: /* fall through */ >> - case 8: return "10.0 Gbps"; >> + case IBV_SPEED_QDR: /* fall through */ >> + case IBV_SPEED_FDR10: return "10.0 Gbps"; >> >> - case 16: return "14.0 Gbps"; >> - case 32: return "25.0 Gbps"; >> + case IBV_SPEED_FDR: return "14.0 Gbps"; >> + case IBV_SPEED_EDR: return "25.0 Gbps"; >> + case IBV_SPEED_HDR: return "50.0 Gbps"; >> + case IBV_SPEE_NDR: return "100.0 Gbps"; > > typo [DS]: I fixed this specifically, my bad while sending out. Will fix. > >> default: return "invalid speed"; >> } >> } >> diff --git a/libibverbs/verbs.h b/libibverbs/verbs.h >> index b27dfd1..39a65fe 100644 >> --- a/libibverbs/verbs.h >> +++ b/libibverbs/verbs.h >> @@ -290,6 +290,24 @@ enum ibv_port_state { >> IBV_PORT_ACTIVE_DEFER = 5 >> }; >> >> +enum ibv_port_speed { >> + IBV_SPEED_SDR = 1, >> + IBV_SPEED_DDR = 2, >> + IBV_SPEED_QDR = 4, >> + IBV_SPEED_FDR10 = 8, >> + IBV_SPEED_FDR = 16, >> + IBV_SPEED_EDR = 32, >> + IBV_SPEED_HDR = 64, >> + IBV_SPEED_NDR = 128 > > HDR is almost defined now but NDR is not. Is it premature to put in NDR > now ? [DS]: Okay, will remove NDR for now. I saw HDR was added into kernel ib_verbs.h but not NDR, it makes perfect sense to remove it. > > Also, if either of these are being added, should 2x also be added ? > > -- Hal > >> +}; >> + >> +enum ibv_port_width { >> + IBV_WIDTH_1X = 1, >> + IBV_WIDTH_4X = 2, >> + IBV_WIDTH_8X = 4, >> + IBV_WIDTH_12X = 8 >> +}; >> + >> enum { >> IBV_LINK_LAYER_UNSPECIFIED, >> IBV_LINK_LAYER_INFINIBAND, >> -- 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 ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2017-05-08 17:13 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-08 13:44 [PATCH] rdma-core: define link speed and link width enums Devesh Sharma
[not found] ` <1494251057-1060-1-git-send-email-devesh.sharma-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
2017-05-08 13:54 ` Leon Romanovsky
[not found] ` <20170508135404.GD10073-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
2017-05-08 14:05 ` Dennis Dalessandro
[not found] ` <e66a9fca-c6b3-ef6e-98b9-08d39bcc72d9-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2017-05-08 14:47 ` Devesh Sharma
[not found] ` <CANjDDBgeoiayNScofG=4CFUNbbqmizbvgtpWSHXcPqhatRSQoA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-05-08 16:12 ` Jason Gunthorpe
[not found] ` <20170508161212.GA18125-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-05-08 17:00 ` Devesh Sharma
[not found] ` <CANjDDBjDwuL8dn4ACkeGw-bBge6_fhFN5DqSAK6h0SPBGeds+Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-05-08 17:13 ` Jason Gunthorpe
2017-05-08 13:54 ` Hal Rosenstock
[not found] ` <de4b2ea7-9613-80c6-b4a1-288f5c5bedcd-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2017-05-08 14:39 ` Devesh Sharma
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox