From: Matan Barak <matanb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
To: Jason Gunthorpe
<jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>,
Or Gerlitz <ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Cc: roland-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org,
linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org
Subject: Re: [PATCH libibverbs V4 4/5] Add ibv_query_port_ex support
Date: Thu, 22 May 2014 12:07:59 +0300 [thread overview]
Message-ID: <537DBE6F.2010902@mellanox.com> (raw)
In-Reply-To: <20140521201059.GC26909-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
On 21/5/2014 11:10 PM, Jason Gunthorpe wrote:
> On Sun, May 18, 2014 at 12:38:48PM +0300, Or Gerlitz wrote:
>> +enum ibv_query_port_ex_attr_mask {
>> + IBV_QUERY_PORT_EX_STATE = 1 << 0,
>> + IBV_QUERY_PORT_EX_MAX_MTU = 1 << 1,
>> + IBV_QUERY_PORT_EX_ACTIVE_MTU = 1 << 2,
>> + IBV_QUERY_PORT_EX_GID_TBL_LEN = 1 << 3,
>> + IBV_QUERY_PORT_EX_CAP_FLAGS = 1 << 4,
>> + IBV_QUERY_PORT_EX_MAX_MSG_SZ = 1 << 5,
>> + IBV_QUERY_PORT_EX_BAD_PKEY_CNTR = 1 << 6,
>> + IBV_QUERY_PORT_EX_QKEY_VIOL_CNTR = 1 << 7,
>> + IBV_QUERY_PORT_EX_PKEY_TBL_LEN = 1 << 8,
>> + IBV_QUERY_PORT_EX_LID = 1 << 9,
>> + IBV_QUERY_PORT_EX_SM_LID = 1 << 10,
>> + IBV_QUERY_PORT_EX_LMC = 1 << 11,
>> + IBV_QUERY_PORT_EX_MAX_VL_NUM = 1 << 12,
>> + IBV_QUERY_PORT_EX_SM_SL = 1 << 13,
>> + IBV_QUERY_PORT_EX_SUBNET_TIMEOUT = 1 << 14,
>> + IBV_QUERY_PORT_EX_INIT_TYPE_REPLY = 1 << 15,
>> + IBV_QUERY_PORT_EX_ACTIVE_WIDTH = 1 << 16,
>> + IBV_QUERY_PORT_EX_ACTIVE_SPEED = 1 << 17,
>> + IBV_QUERY_PORT_EX_PHYS_STATE = 1 << 18,
>> + IBV_QUERY_PORT_EX_LINK_LAYER = 1 << 19,
>> + /* mask of the fields that exists in the standard query_port_command */
>> + IBV_QUERY_PORT_EX_STD_MASK = (1 << 20) - 1,
>> + /* mask of all supported fields */
>> + IBV_QUERY_PORT_EX_MASK = IBV_QUERY_PORT_EX_STD_MASK,
>> +};
>
> OK
>
>> +struct ibv_port_attr_ex {
>> + enum ibv_port_state state;
>> + enum ibv_mtu max_mtu;
>> + enum ibv_mtu active_mtu;
>> + int gid_tbl_len;
>> + uint32_t port_cap_flags;
>> + uint32_t max_msg_sz;
>> + uint32_t bad_pkey_cntr;
>> + uint32_t qkey_viol_cntr;
>> + uint16_t pkey_tbl_len;
>> + uint16_t lid;
>> + uint16_t sm_lid;
>> + uint8_t lmc;
>> + uint8_t max_vl_num;
>> + uint8_t sm_sl;
>> + uint8_t subnet_timeout;
>> + uint8_t init_type_reply;
>> + uint8_t active_width;
>> + uint8_t active_speed;
>> + uint8_t phys_state;
>> + uint8_t link_layer;
>> + uint8_t reserved;
>
> OK
>
>> + uint32_t comp_mask;
>
> This uses the first 20 bits already, should comp_mask just be 64 bits
> off the bat?
>
First of all, I think that comp_mask should be the same type for all
extension verbs and since ibv_flow_attr already uses a 32bit comp_mask,
so should this verb.
Moreover, I don't think we expect to reach 32 values anytime soon.
In term of future scalability, I understand that the last bit is
reserved for comp_mask2 field.
>> @@ -998,6 +1050,8 @@ enum verbs_context_mask {
>>
>> struct verbs_context {
>> /* "grows up" - new fields go here */
>> + int (*query_port_ex)(struct ibv_context *context, uint8_t port_num,
>> + struct ibv_port_attr_ex *port_attr);
>
> OK
>
>> +static inline int ibv_query_port_ex(struct ibv_context *context,
>> + uint8_t port_num,
>> + struct ibv_port_attr_ex *port_attr)
>> +{
>> + struct verbs_context *vctx;
>> +
>> + port_attr->link_layer = IBV_LINK_LAYER_UNSPECIFIED;
>> + port_attr->reserved = 0;
>
> We don't need this. All the calls to ibv_query_port already set these
> values and we can simply require that all implementations of
> ibv_query_port_ex set them too.
Correct
>
>> + if (0 == port_attr->comp_mask)
>> + return ibv_query_port(context, port_num,
>> + (struct ibv_port_attr *)port_attr);
>
> I'm confused what this is doing? Why is 0 ever a valid comp_mask?
>
I'll remove this.
>> + /* Check that only valid flags were given */
>> + if (port_attr->comp_mask & ~IBV_QUERY_PORT_EX_MASK) {
>> + errno = EINVAL;
>> + return -errno;
>> + }
>
> And this doesn't seem to make sense either.
>
Sanity check - the user should provide a combination of
ibv_query_port_ex_attr_mask flags.
>> + vctx = verbs_get_ctx_op(context, query_port_ex);
>> +
>> + if (!vctx) {
>> + /* Fallback to legacy mode */
>> + if (!(port_attr->comp_mask & ~IBV_QUERY_PORT_EX_STD_MASK))
>> + return ibv_query_port(context, port_num,
>> + (struct ibv_port_attr *)port_attr);
>> +
>> + /* Unsupported field was requested */
>> + errno = ENOSYS;
>> + return -errno;
>> + }
>> +
>> + return vctx->query_port_ex(context, port_num, port_attr);
>> +}
>> +
>> #define ibv_query_port(context, port_num, port_attr) \
>> ___ibv_query_port(context, port_num, port_attr)
>>
>> diff --git a/man/ibv_query_port_ex.3 b/man/ibv_query_port_ex.3
>> new file mode 100644
>> index 0000000..07073fd
>> +++ b/man/ibv_query_port_ex.3
>> @@ -0,0 +1,97 @@
>> +.\" -*- nroff -*-
>> +.\"
>> +.TH IBV_QUERY_PORT_EX 3 2006-10-31 libibverbs "Libibverbs Programmer's Manual"
>> +.SH "NAME"
>> +ibv_query_port_ex \- query an RDMA port's attributes
>> +.SH "SYNOPSIS"
>> +.nf
>> +.B #include <infiniband/verbs.h>
>> +.sp
>> +.BI "int ibv_query_port_ex(struct ibv_context " "*context" ", uint8_t " "port_num" ,
>> +.BI " struct ibv_port_attr_ex " "*port_attr" ");
>> +.fi
>> +.SH "DESCRIPTION"
>> +.B ibv_query_port_ex()
>
> I feel it would be nicer to just patch the existing ibv_query_port man
> page to have the new call and a paragraph about the extra field.
>
> Similar to how 'man accept' works with accept and accept4
>
>
Ok
>> +returns the attributes of port
>> +.I port_num
>> +for device context
>> +.I context
>> +through the pointer
>> +.I port_attr\fR.
>> +The argument
>> +.I port_attr
>> +is an ibv_port_attr struct, as defined in <infiniband/verbs.h>.
> ^^^^^^^
>
> No it isn't. Please proof-read everything.
>
> Jason
>
Matan
--
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
next prev parent reply other threads:[~2014-05-22 9:07 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-18 9:38 [PATCH libibverbs V4 0/5] Add support for UD QPs under RoCE IP addressing Or Gerlitz
[not found] ` <1400405929-14313-1-git-send-email-ogerlitz-lZu6o6FoHf8DyJZ7l8Lk7nI+JuX82XLG@public.gmane.org>
2014-05-18 9:38 ` [PATCH libibverbs V4 1/5] Add ibv_port_cap_flags Or Gerlitz
[not found] ` <1400405929-14313-2-git-send-email-ogerlitz-lZu6o6FoHf8DyJZ7l8Lk7nI+JuX82XLG@public.gmane.org>
2014-05-20 6:41 ` Matan Barak
2014-05-18 9:38 ` [PATCH libibverbs V4 2/5] Extend create_ah in order to pass L2 parameters to the provider Or Gerlitz
[not found] ` <1400405929-14313-3-git-send-email-ogerlitz-lZu6o6FoHf8DyJZ7l8Lk7nI+JuX82XLG@public.gmane.org>
2014-05-21 19:55 ` Jason Gunthorpe
[not found] ` <20140521195549.GA26909-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2014-05-22 8:52 ` Matan Barak
[not found] ` <537DBAC3.9090008-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2014-06-11 10:54 ` Or Gerlitz
[not found] ` <53983580.1080002-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2014-06-11 15:05 ` Jason Gunthorpe
2014-05-18 9:38 ` [PATCH libibverbs V4 3/5] Use neighbour lookup for RoCE UD QPs Eth L2 resolution Or Gerlitz
[not found] ` <1400405929-14313-4-git-send-email-ogerlitz-lZu6o6FoHf8DyJZ7l8Lk7nI+JuX82XLG@public.gmane.org>
2014-05-21 20:31 ` Jason Gunthorpe
[not found] ` <20140521203107.GD26909-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2014-06-12 12:44 ` Matan Barak
[not found] ` <5399A093.9070104-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2014-06-12 17:40 ` Jason Gunthorpe
2014-05-18 9:38 ` [PATCH libibverbs V4 4/5] Add ibv_query_port_ex support Or Gerlitz
[not found] ` <1400405929-14313-5-git-send-email-ogerlitz-lZu6o6FoHf8DyJZ7l8Lk7nI+JuX82XLG@public.gmane.org>
2014-05-21 20:10 ` Jason Gunthorpe
[not found] ` <20140521201059.GC26909-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2014-05-22 9:07 ` Matan Barak [this message]
2014-05-18 9:38 ` [PATCH libibverbs V4 5/5] Optimize ibv_create_ah link query Or Gerlitz
2014-05-20 6:58 ` [PATCH libibverbs V4 0/5] Add support for UD QPs under RoCE IP addressing Or Gerlitz
[not found] ` <537AFD31.3000401-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2014-07-24 11:34 ` Devesh Sharma
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=537DBE6F.2010902@mellanox.com \
--to=matanb-vpraknaxozvwk0htik3j/w@public.gmane.org \
--cc=dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
--cc=roland-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).