From: Yishai Hadas <yishaih-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
To: Jason Gunthorpe
<jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
Cc: Yishai Hadas <yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>,
dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
bodong-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org,
majd-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org
Subject: Re: [PATCH rdma-core 2/3] ibverbs: Add support for packet pacing
Date: Mon, 9 Jan 2017 18:46:33 +0200 [thread overview]
Message-ID: <b9cca64f-0d67-6174-74e5-291f93b48c1c@dev.mellanox.co.il> (raw)
In-Reply-To: <20170109153856.GA29687-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
On 1/9/2017 5:38 PM, Jason Gunthorpe wrote:
> On Sun, Jan 08, 2017 at 06:32:27PM +0200, Yishai Hadas wrote:
>> +int ibv_cmd_modify_qp_ex(struct ibv_qp *qp, struct ibv_qp_attr *attr,
>> + int attr_mask, struct ibv_modify_qp_ex *cmd,
>> + size_t cmd_core_size, size_t cmd_size,
>> + struct ibv_modify_qp_resp_ex *resp,
>> + size_t resp_core_size, size_t resp_size)
>> +{
>> + if (resp_core_size < offsetof(struct ibv_modify_qp_resp_ex,
>> + response_length) + sizeof(resp->response_length))
>> + return EINVAL;
>> +
>> + IBV_INIT_CMD_RESP_EX_V(cmd, cmd_core_size, cmd_size, MODIFY_QP_EX,
>> + resp, resp_core_size, resp_size);
>> +
>> + copy_modify_qp_fields(qp, attr, attr_mask, &cmd->base);
>> +
>> + if (attr_mask & IBV_QP_RATE_LIMIT) {
>> + if (cmd_size >= offsetof(struct ibv_modify_qp_ex, rate_limit) +
>> + sizeof(cmd->rate_limit))
>> + cmd->rate_limit = attr->rate_limit;
>> + else
>> + return EINVAL;
>> + }
>
> cmd->rate_limit is not being 0'd if it isn't set
The 'cmd' was fully set to 0'd by the provider, see usage in the last patch.
In case we want to do it in this layer I would vote on using memset at
the beginning of that function to prevent repeating this for any new
field. Your last patch in that area could do it as well.
>> @@ -829,7 +829,8 @@ enum ibv_qp_attr_mask {
>> IBV_QP_MAX_DEST_RD_ATOMIC = 1 << 17,
>> IBV_QP_PATH_MIG_STATE = 1 << 18,
>> IBV_QP_CAP = 1 << 19,
>> - IBV_QP_DEST_QPN = 1 << 20
>> + IBV_QP_DEST_QPN = 1 << 20,
>> + IBV_QP_RATE_LIMIT = 1 << 25,
>> };
>
> Why 25? 21 I think.
To match kernel, 21-24 are reserved.
>
>> enum ibv_qp_state {
>> @@ -875,6 +876,7 @@ struct ibv_qp_attr {
>> uint8_t rnr_retry;
>> uint8_t alt_port_num;
>> uint8_t alt_timeout;
>> + uint32_t rate_limit;
>> };
>
> Nope, this is returned by query_qp so you cannot just extend it.
It's safe, please see below.
>
> You are supporting query_qp, right?
At the moment the kernel doesn't support an extended command for
query_qp so user space doesn't get and touch this field.
Once support will be added in the kernel, the attr_mask field of
ibv_query_qp should be used to indicate whether application asked for
that field (i.e. IBV_QP_RATE_LIMIT) and supplied an input structure that
has memory to hold this output so it's safe to extend the above
structure. Same idea was used in this series for accessing this field in
modify_qp as an input.
We can consider adding an extra check in ibv_cmd_query_qp as part of
this series to check whether IBV_QP_RATE_LIMIT or higher bits were
asked, if yes return an error as there is no support for that value
without using an extended command, makes sense ?
>
> 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
>
--
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:[~2017-01-09 16:46 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-08 16:32 [PATCH rdma-core 0/3] Add packet pacing support Yishai Hadas
[not found] ` <1483893148-8211-1-git-send-email-yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2017-01-08 16:32 ` [PATCH rdma-core 1/3] ibverbs: Report packet pacing capabilities when querying device Yishai Hadas
2017-01-08 16:32 ` [PATCH rdma-core 2/3] ibverbs: Add support for packet pacing Yishai Hadas
[not found] ` <1483893148-8211-3-git-send-email-yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2017-01-09 15:38 ` Jason Gunthorpe
[not found] ` <20170109153856.GA29687-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-01-09 16:46 ` Yishai Hadas [this message]
[not found] ` <b9cca64f-0d67-6174-74e5-291f93b48c1c-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2017-01-09 17:02 ` Jason Gunthorpe
[not found] ` <20170109170200.GB13960-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-01-09 21:44 ` Yishai Hadas
[not found] ` <c50008b5-f0f2-a1a4-94e7-2354ea2b0123-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2017-01-10 8:18 ` Leon Romanovsky
2017-01-08 16:32 ` [PATCH rdma-core 3/3] mlx5: Add packet pacing support Yishai Hadas
[not found] ` <1483893148-8211-4-git-send-email-yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2017-01-09 15:39 ` Jason Gunthorpe
[not found] ` <20170109153943.GB29687-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-01-09 16:56 ` Yishai Hadas
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=b9cca64f-0d67-6174-74e5-291f93b48c1c@dev.mellanox.co.il \
--to=yishaih-ldsdmyg8hgv8yrgs2mwiifqbs+8scbdb@public.gmane.org \
--cc=bodong-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=majd-VPRAkNaXOzVWk0Htik3J/w@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.