From: Andrew Rybchenko <arybchenko@solarflare.com>
To: <stable@dpdk.org>
Cc: Andy Moreton <amoreton@solarflare.com>
Subject: [dpdk-stable] [PATCH 17.11 2/6] net/sfc/base: fix ID retrieval in v3 licensing
Date: Mon, 10 Dec 2018 15:10:52 +0000 [thread overview]
Message-ID: <1544454656-5339-2-git-send-email-arybchenko@solarflare.com> (raw)
In-Reply-To: <1544454656-5339-1-git-send-email-arybchenko@solarflare.com>
From: Andy Moreton <amoreton@solarflare.com>
[ backported from upstream commit 416aa7f1c98acfaf996a54f63fd2a02dc5ef3a73 ]
Fixes: 05fce2ce8451 ("net/sfc/base: import libefx licensing")
Fixes: f67e4719147d ("net/sfc/base: fix coding style")
Signed-off-by: Andy Moreton <amoreton@solarflare.com>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
drivers/net/sfc/base/efx_lic.c | 38 +++++++++-----------------------------
1 file changed, 9 insertions(+), 29 deletions(-)
diff --git a/drivers/net/sfc/base/efx_lic.c b/drivers/net/sfc/base/efx_lic.c
index 2cd05cc..26f38ec 100644
--- a/drivers/net/sfc/base/efx_lic.c
+++ b/drivers/net/sfc/base/efx_lic.c
@@ -1035,26 +1035,14 @@
{
efx_mcdi_req_t req;
uint8_t payload[MAX(MC_CMD_LICENSING_GET_ID_V3_IN_LEN,
- MC_CMD_LICENSING_GET_ID_V3_OUT_LENMIN)];
+ MC_CMD_LICENSING_GET_ID_V3_OUT_LENMAX)];
efx_rc_t rc;
req.emr_cmd = MC_CMD_LICENSING_GET_ID_V3;
-
- if (bufferp == NULL) {
- /* Request id type and length only */
- req.emr_in_buf = bufferp;
- req.emr_in_length = MC_CMD_LICENSING_GET_ID_V3_IN_LEN;
- req.emr_out_buf = bufferp;
- req.emr_out_length = MC_CMD_LICENSING_GET_ID_V3_OUT_LENMIN;
- (void) memset(payload, 0, sizeof (payload));
- } else {
- /* Request full buffer */
- req.emr_in_buf = bufferp;
- req.emr_in_length = MC_CMD_LICENSING_GET_ID_V3_IN_LEN;
- req.emr_out_buf = bufferp;
- req.emr_out_length = MIN(buffer_size, MC_CMD_LICENSING_GET_ID_V3_OUT_LENMAX);
- (void) memset(bufferp, 0, req.emr_out_length);
- }
+ req.emr_in_buf = payload;
+ req.emr_in_length = MC_CMD_LICENSING_GET_ID_V3_IN_LEN;
+ req.emr_out_buf = payload;
+ req.emr_out_length = MC_CMD_LICENSING_GET_ID_V3_OUT_LENMAX;
efx_mcdi_execute_quiet(enp, &req);
@@ -1071,18 +1059,10 @@
*typep = MCDI_OUT_DWORD(req, LICENSING_GET_ID_V3_OUT_LICENSE_TYPE);
*lengthp = MCDI_OUT_DWORD(req, LICENSING_GET_ID_V3_OUT_LICENSE_ID_LENGTH);
- if (bufferp == NULL) {
- /* modify length requirements to indicate to caller the extra buffering
- ** needed to read the complete output.
- */
- *lengthp += MC_CMD_LICENSING_GET_ID_V3_OUT_LENMIN;
- } else {
- /* Shift ID down to start of buffer */
- memmove(bufferp,
- bufferp + MC_CMD_LICENSING_GET_ID_V3_OUT_LICENSE_ID_OFST,
- *lengthp);
- memset(bufferp + (*lengthp), 0,
- MC_CMD_LICENSING_GET_ID_V3_OUT_LICENSE_ID_OFST);
+ if (bufferp != NULL) {
+ memcpy(bufferp,
+ payload + MC_CMD_LICENSING_GET_ID_V3_OUT_LICENSE_ID_OFST,
+ MIN(buffer_size, *lengthp));
}
return (0);
--
1.8.3.1
next prev parent reply other threads:[~2018-12-10 15:11 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-10 15:10 [dpdk-stable] [PATCH 17.11 1/6] net/failsafe: fix crash on slave queue release Andrew Rybchenko
2018-12-10 15:10 ` Andrew Rybchenko [this message]
2018-12-10 15:10 ` [dpdk-stable] [PATCH 17.11 3/6] net/failsafe: add checks for deferred queue setup Andrew Rybchenko
2018-12-10 15:10 ` [dpdk-stable] [PATCH 17.11 4/6] net/sfc: do not skip RSS configuration step on reconfigure Andrew Rybchenko
2018-12-10 15:10 ` [dpdk-stable] [PATCH 17.11 5/6] net/sfc: allow to query RSS key and HF in isolated mode Andrew Rybchenko
2018-12-10 15:10 ` [dpdk-stable] [PATCH 17.11 6/6] net/sfc: allow to query RSS key and HF when RSS is disabled Andrew Rybchenko
2018-12-11 19:08 ` [dpdk-stable] [PATCH 17.11 1/6] net/failsafe: fix crash on slave queue release Yongseok Koh
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=1544454656-5339-2-git-send-email-arybchenko@solarflare.com \
--to=arybchenko@solarflare.com \
--cc=amoreton@solarflare.com \
--cc=stable@dpdk.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).