From: Andrew Rybchenko <arybchenko@solarflare.com>
To: <dev@dpdk.org>
Cc: Richard Houldsworth <rhouldsworth@solarflare.com>
Subject: [dpdk-dev] [PATCH 06/29] net/sfc/base: add driver version string registration
Date: Mon, 10 Jun 2019 08:38:21 +0100 [thread overview]
Message-ID: <1560152324-20538-7-git-send-email-arybchenko@solarflare.com> (raw)
In-Reply-To: <1560152324-20538-1-git-send-email-arybchenko@solarflare.com>
From: Richard Houldsworth <rhouldsworth@solarflare.com>
Support the registration of a version string by the libefx
client. The string is passed on to the MC in efx_nic_probe
only to allow the MC to advertise the OS driver version in
NC-SI, and the content is considered opaque for libefx.
Signed-off-by: Richard Houldsworth <rhouldsworth@solarflare.com>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
drivers/net/sfc/base/efx.h | 13 +++++++++++++
drivers/net/sfc/base/efx_impl.h | 3 +++
drivers/net/sfc/base/efx_mcdi.c | 16 ++++++++++++++--
drivers/net/sfc/base/efx_nic.c | 35 +++++++++++++++++++++++++++++++++++
4 files changed, 65 insertions(+), 2 deletions(-)
diff --git a/drivers/net/sfc/base/efx.h b/drivers/net/sfc/base/efx.h
index 8a2bb39..700c998 100644
--- a/drivers/net/sfc/base/efx.h
+++ b/drivers/net/sfc/base/efx.h
@@ -1463,6 +1463,19 @@ enum {
__inout efx_nic_t *enp,
__in efx_drv_limits_t *edlp);
+/*
+ * Register the OS driver version string for management agents
+ * (e.g. via NC-SI). The content length is provided (i.e. no
+ * NUL terminator). Use length 0 to indicate no version string
+ * should be advertised. It is valid to set the version string
+ * only before efx_nic_probe() is called.
+ */
+extern __checkReturn efx_rc_t
+efx_nic_set_drv_version(
+ __inout efx_nic_t *enp,
+ __in_ecount(length) char const *verp,
+ __in size_t length);
+
typedef enum efx_nic_region_e {
EFX_REGION_VI, /* Memory BAR UC mapping */
EFX_REGION_PIO_WRITE_VI, /* Memory BAR WC mapping */
diff --git a/drivers/net/sfc/base/efx_impl.h b/drivers/net/sfc/base/efx_impl.h
index f148c87..b5ac84d 100644
--- a/drivers/net/sfc/base/efx_impl.h
+++ b/drivers/net/sfc/base/efx_impl.h
@@ -647,6 +647,8 @@
#endif
+#define EFX_DRV_VER_MAX 20
+
typedef struct efx_drv_cfg_s {
uint32_t edc_min_vi_count;
uint32_t edc_max_vi_count;
@@ -677,6 +679,7 @@ struct efx_nic_s {
const efx_tx_ops_t *en_etxop;
const efx_rx_ops_t *en_erxop;
efx_fw_variant_t efv;
+ char en_drv_version[EFX_DRV_VER_MAX];
#if EFSYS_OPT_FILTER
efx_filter_t en_filter;
const efx_filter_ops_t *en_efop;
diff --git a/drivers/net/sfc/base/efx_mcdi.c b/drivers/net/sfc/base/efx_mcdi.c
index adc2eb8..584fd4d 100644
--- a/drivers/net/sfc/base/efx_mcdi.c
+++ b/drivers/net/sfc/base/efx_mcdi.c
@@ -1256,13 +1256,17 @@
__in boolean_t attach)
{
efx_mcdi_req_t req;
- EFX_MCDI_DECLARE_BUF(payload, MC_CMD_DRV_ATTACH_IN_LEN,
+ EFX_MCDI_DECLARE_BUF(payload, MC_CMD_DRV_ATTACH_IN_V2_LEN,
MC_CMD_DRV_ATTACH_EXT_OUT_LEN);
efx_rc_t rc;
req.emr_cmd = MC_CMD_DRV_ATTACH;
req.emr_in_buf = payload;
- req.emr_in_length = MC_CMD_DRV_ATTACH_IN_LEN;
+ if (enp->en_drv_version[0] == '\0') {
+ req.emr_in_length = MC_CMD_DRV_ATTACH_IN_LEN;
+ } else {
+ req.emr_in_length = MC_CMD_DRV_ATTACH_IN_V2_LEN;
+ }
req.emr_out_buf = payload;
req.emr_out_length = MC_CMD_DRV_ATTACH_EXT_OUT_LEN;
@@ -1283,6 +1287,14 @@
MCDI_IN_SET_DWORD(req, DRV_ATTACH_IN_UPDATE, 1);
MCDI_IN_SET_DWORD(req, DRV_ATTACH_IN_FIRMWARE_ID, enp->efv);
+ if (req.emr_in_length >= MC_CMD_DRV_ATTACH_IN_V2_LEN) {
+ EFX_STATIC_ASSERT(sizeof (enp->en_drv_version) ==
+ MC_CMD_DRV_ATTACH_IN_V2_DRIVER_VERSION_LEN);
+ memcpy(MCDI_IN2(req, char, DRV_ATTACH_IN_V2_DRIVER_VERSION),
+ enp->en_drv_version,
+ MC_CMD_DRV_ATTACH_IN_V2_DRIVER_VERSION_LEN);
+ }
+
efx_mcdi_execute(enp, &req);
if (req.emr_rc != 0) {
diff --git a/drivers/net/sfc/base/efx_nic.c b/drivers/net/sfc/base/efx_nic.c
index 3ec5cbc..c1285bf 100644
--- a/drivers/net/sfc/base/efx_nic.c
+++ b/drivers/net/sfc/base/efx_nic.c
@@ -380,6 +380,41 @@
}
__checkReturn efx_rc_t
+efx_nic_set_drv_version(
+ __inout efx_nic_t *enp,
+ __in_ecount(length) char const *verp,
+ __in size_t length)
+{
+ efx_rc_t rc;
+
+ EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
+ EFSYS_ASSERT(!(enp->en_mod_flags & EFX_MOD_PROBE));
+
+ /*
+ * length is the string content length in bytes.
+ * Accept any content which fits into the version
+ * buffer, excluding the last byte. This is reserved
+ * for an appended NUL terminator.
+ */
+ if (length >= sizeof (enp->en_drv_version)) {
+ rc = E2BIG;
+ goto fail1;
+ }
+
+ (void) memset(enp->en_drv_version, 0,
+ sizeof (enp->en_drv_version));
+ memcpy(enp->en_drv_version, verp, length);
+
+ return (0);
+
+fail1:
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
+
+ return (rc);
+}
+
+
+ __checkReturn efx_rc_t
efx_nic_get_bar_region(
__in efx_nic_t *enp,
__in efx_nic_region_t region,
--
1.8.3.1
next prev parent reply other threads:[~2019-06-10 7:41 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-10 7:38 [dpdk-dev] [PATCH 00/29] net/sfc/base: update base driver Andrew Rybchenko
2019-06-10 7:38 ` [dpdk-dev] [PATCH 01/29] net/sfc/base: enable chained multicast on all EF10 cards Andrew Rybchenko
2019-06-10 7:38 ` [dpdk-dev] [PATCH 02/29] net/sfc/base: fix signed/unsigned mismatch errors Andrew Rybchenko
2019-06-10 7:38 ` [dpdk-dev] [PATCH 03/29] net/sfc/base: fix shift by more bits than field width Andrew Rybchenko
2019-06-10 7:38 ` [dpdk-dev] [PATCH 04/29] net/sfc/base: improve code style in sensors decoding Andrew Rybchenko
2019-06-10 7:38 ` [dpdk-dev] [PATCH 05/29] net/sfc/base: do not rely on indirect header inclusion Andrew Rybchenko
2019-06-10 7:38 ` Andrew Rybchenko [this message]
2019-06-10 7:38 ` [dpdk-dev] [PATCH 07/29] net/sfc/base: add capabilities for bundle partition support Andrew Rybchenko
2019-06-10 7:38 ` [dpdk-dev] [PATCH 08/29] net/sfc/base: add extensible NVRAM info function Andrew Rybchenko
2019-06-10 7:38 ` [dpdk-dev] [PATCH 09/29] net/sfc/base: add NVRAM info to API Andrew Rybchenko
2019-06-10 7:38 ` [dpdk-dev] [PATCH 10/29] net/sfc/base: update MCDI headers Andrew Rybchenko
2019-06-10 7:38 ` [dpdk-dev] [PATCH 11/29] net/sfc/base: add firmware ID header Andrew Rybchenko
2019-06-10 7:38 ` [dpdk-dev] [PATCH 12/29] net/sfc/base: support direct FW update for bundle partitions Andrew Rybchenko
2019-06-10 7:38 ` [dpdk-dev] [PATCH 13/29] net/sfc/base: transition to the extensible NVRAM info API Andrew Rybchenko
2019-06-10 7:38 ` [dpdk-dev] [PATCH 14/29] net/sfc/base: add background mode firmware updating Andrew Rybchenko
2019-06-10 7:38 ` [dpdk-dev] [PATCH 15/29] net/sfc/base: add definition of bundle metadata partition Andrew Rybchenko
2019-06-10 7:38 ` [dpdk-dev] [PATCH 16/29] net/sfc/base: add definition of OEM TLV Andrew Rybchenko
2019-06-10 7:38 ` [dpdk-dev] [PATCH 17/29] net/sfc/base: export the zero-based MCDI port number Andrew Rybchenko
2019-06-10 7:38 ` [dpdk-dev] [PATCH 18/29] net/sfc/base: introduce of EVB module for SR-IOV support Andrew Rybchenko
2019-06-10 7:38 ` [dpdk-dev] [PATCH 19/29] net/sfc/base: add MCDI wrappers for vPort and vSwitch in EVB Andrew Rybchenko
2019-06-10 7:38 ` [dpdk-dev] [PATCH 20/29] net/sfc/base: add EVB module vSwitch/vPort/vAdaptor ops Andrew Rybchenko
2019-06-10 7:38 ` [dpdk-dev] [PATCH 21/29] net/sfc/base: implement vSwitch create/destroy Andrew Rybchenko
2019-06-10 7:38 ` [dpdk-dev] [PATCH 22/29] net/sfc/base: factor out upstream port vAdaptor allocation Andrew Rybchenko
2019-06-10 7:38 ` [dpdk-dev] [PATCH 23/29] net/sfc/base: support data path with EVB module Andrew Rybchenko
2019-06-10 7:38 ` [dpdk-dev] [PATCH 24/29] net/sfc/base: support proxy auth operations for SR-IOV Andrew Rybchenko
2019-06-10 7:38 ` [dpdk-dev] [PATCH 25/29] net/sfc/base: implement proxy auth MCDI event handling Andrew Rybchenko
2019-06-10 7:38 ` [dpdk-dev] [PATCH 26/29] net/sfc/base: provide proxy APIs to client drivers Andrew Rybchenko
2019-06-10 7:38 ` [dpdk-dev] [PATCH 27/29] net/sfc/base: provide APIs to configure and reset vPort Andrew Rybchenko
2019-06-10 7:38 ` [dpdk-dev] [PATCH 28/29] net/sfc/base: provide API to fetch vPort statistics Andrew Rybchenko
2019-06-10 7:38 ` [dpdk-dev] [PATCH 29/29] net/sfc/base: add APIs for PTP privilege configuration Andrew Rybchenko
2019-06-18 7:52 ` [dpdk-dev] [PATCH 00/29] net/sfc/base: update base driver Ferruh Yigit
2019-06-23 22:37 ` Thomas Monjalon
2019-06-24 7:53 ` Andrew Rybchenko
2019-06-24 11:17 ` Ferruh Yigit
2019-06-24 13:07 ` Thomas Monjalon
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=1560152324-20538-7-git-send-email-arybchenko@solarflare.com \
--to=arybchenko@solarflare.com \
--cc=dev@dpdk.org \
--cc=rhouldsworth@solarflare.com \
/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).