From: Jiri Pirko <jiri@resnulli.us>
To: Vasundhara Volam <vasundhara-v.volam@broadcom.com>
Cc: davem@davemloft.net, michael.chan@broadcom.com,
jiri@mellanox.com, netdev@vger.kernel.org
Subject: Re: [PATCH net-next RFC 7/7] bnxt_en: Add bnxt_en initial port params table and register it
Date: Wed, 5 Dec 2018 14:05:46 +0100 [thread overview]
Message-ID: <20181205130546.GH2318@nanopsycho> (raw)
In-Reply-To: <1543989420-14859-8-git-send-email-vasundhara-v.volam@broadcom.com>
Wed, Dec 05, 2018 at 06:57:00AM CET, vasundhara-v.volam@broadcom.com wrote:
>Register devlink_port with devlink and create initial port params
>table for bnxt_en. The table consists of a generic parameter:
>
>wake-on-lan: Enables Wake on Lan for this port when magic packet
>is received with this port's MAC address using ACPI pattern.
>If enabled, the controller asserts a wake pin upon reception of
>WoL packet. ACPI (Advanced Configuration and Power Interface) is
>an industry specification for the efficient handling of power
>consumption in desktop and mobile computers.
>
>Cc: Michael Chan <michael.chan@broadcom.com>
>Signed-off-by: Vasundhara Volam <vasundhara-v.volam@broadcom.com>
>---
> drivers/net/ethernet/broadcom/bnxt/bnxt.h | 1 +
> drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c | 35 +++++++++++++++++++++++
> drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.h | 1 +
> 3 files changed, 37 insertions(+)
>
>diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.h b/drivers/net/ethernet/broadcom/bnxt/bnxt.h
>index 9e99d4a..0ba62b3 100644
>--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.h
>+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.h
>@@ -1585,6 +1585,7 @@ struct bnxt {
>
> /* devlink interface and vf-rep structs */
> struct devlink *dl;
>+ struct devlink_port dl_port;
> enum devlink_eswitch_mode eswitch_mode;
> struct bnxt_vf_rep **vf_reps; /* array of vf-rep ptrs */
> u16 *cfa_code_map; /* cfa_code -> vf_idx map */
>diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c
>index 140dbd6..a2930d5 100644
>--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c
>+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c
>@@ -26,6 +26,10 @@ enum bnxt_dl_param_id {
> BNXT_DEVLINK_PARAM_ID_GRE_VER_CHECK,
> };
>
>+enum bnxt_dl_port_param_id {
>+ BNXT_DEVLINK_PORT_PARAM_ID_BASE = DEVLINK_PORT_PARAM_GENERIC_ID_MAX,
>+};
>+
> static const struct bnxt_dl_nvm_param nvm_params[] = {
> {DEVLINK_PARAM_GENERIC_ID_ENABLE_SRIOV, NVM_OFF_ENABLE_SRIOV,
> BNXT_NVM_SHARED_CFG, 1},
>@@ -37,6 +41,8 @@ enum bnxt_dl_param_id {
> NVM_OFF_MSIX_VEC_PER_PF_MIN, BNXT_NVM_SHARED_CFG, 7},
> {BNXT_DEVLINK_PARAM_ID_GRE_VER_CHECK, NVM_OFF_DIS_GRE_VER_CHECK,
> BNXT_NVM_SHARED_CFG, 1},
>+
>+ {DEVLINK_PORT_PARAM_GENERIC_ID_WOL, NVM_OFF_WOL, BNXT_NVM_PORT_CFG, 1},
> };
>
> static int bnxt_hwrm_nvm_req(struct bnxt *bp, u32 param_id, void *msg,
>@@ -188,6 +194,12 @@ static int bnxt_dl_msix_validate(struct devlink *dl, u32 id,
> NULL),
> };
>
>+static const struct devlink_param bnxt_dl_port_params[] = {
>+ DEVLINK_PORT_PARAM_GENERIC(WOL, BIT(DEVLINK_PARAM_CMODE_PERMANENT),
>+ bnxt_dl_nvm_param_get, bnxt_dl_nvm_param_set,
>+ NULL),
>+};
>+
> int bnxt_dl_register(struct bnxt *bp)
> {
> struct devlink *dl;
>@@ -225,8 +237,28 @@ int bnxt_dl_register(struct bnxt *bp)
> goto err_dl_unreg;
> }
>
>+ rc = devlink_port_register(dl, &bp->dl_port, bp->pf.port_id);
>+ if (rc) {
>+ netdev_warn(bp->dev, "devlink_port_register failed. rc=%d",
>+ rc);
>+ goto err_dl_param_unreg;
>+ }
>+ bp->dl_port.type = DEVLINK_PORT_TYPE_ETH;
Please use devlink_port_type_set()
>+
>+ rc = devlink_port_params_register(&bp->dl_port, bnxt_dl_port_params,
>+ ARRAY_SIZE(bnxt_dl_port_params));
>+ if (rc) {
>+ netdev_warn(bp->dev, "devlink_port_params_register failed. rc=%d",
>+ rc);
>+ goto err_dl_port_unreg;
>+ }
> return 0;
>
>+err_dl_port_unreg:
>+ devlink_port_unregister(&bp->dl_port);
>+err_dl_param_unreg:
>+ devlink_params_unregister(dl, bnxt_dl_params,
>+ ARRAY_SIZE(bnxt_dl_params));
> err_dl_unreg:
> devlink_unregister(dl);
> err_dl_free:
>@@ -242,6 +274,9 @@ void bnxt_dl_unregister(struct bnxt *bp)
> if (!dl)
> return;
>
>+ devlink_port_params_unregister(&bp->dl_port, bnxt_dl_port_params,
>+ ARRAY_SIZE(bnxt_dl_port_params));
>+ devlink_port_unregister(&bp->dl_port);
> devlink_params_unregister(dl, bnxt_dl_params,
> ARRAY_SIZE(bnxt_dl_params));
> devlink_unregister(dl);
>diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.h b/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.h
>index 5b6b2c7..da065ca 100644
>--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.h
>+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.h
>@@ -35,6 +35,7 @@ static inline void bnxt_link_bp_to_dl(struct bnxt *bp, struct devlink *dl)
>
> #define NVM_OFF_MSIX_VEC_PER_PF_MAX 108
> #define NVM_OFF_MSIX_VEC_PER_PF_MIN 114
>+#define NVM_OFF_WOL 152
> #define NVM_OFF_IGNORE_ARI 164
> #define NVM_OFF_DIS_GRE_VER_CHECK 171
> #define NVM_OFF_ENABLE_SRIOV 401
>--
>1.8.3.1
>
next prev parent reply other threads:[~2018-12-05 13:12 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-05 5:56 [PATCH net-next RFC 0/7] Add configuration parameters support for devlink_port Vasundhara Volam
2018-12-05 5:56 ` [PATCH net-next RFC 1/7] devlink: Add devlink_param for port register and unregister Vasundhara Volam
2018-12-05 11:47 ` Jiri Pirko
2018-12-06 6:02 ` Vasundhara Volam
2018-12-06 7:06 ` Jiri Pirko
2018-12-06 7:26 ` Vasundhara Volam
2018-12-10 9:21 ` Vasundhara Volam
2018-12-10 11:29 ` Jiri Pirko
2018-12-05 5:56 ` [PATCH net-next RFC 2/7] devlink: Add port param get command Vasundhara Volam
2018-12-05 11:51 ` Jiri Pirko
2018-12-05 5:56 ` [PATCH net-next RFC 3/7] devlink: Add port param set command Vasundhara Volam
2018-12-05 12:13 ` Jiri Pirko
2018-12-05 5:56 ` [PATCH net-next RFC 4/7] devlink: Add support for get/set driverinit value for devlink_port Vasundhara Volam
2018-12-05 12:59 ` Jiri Pirko
2018-12-05 5:56 ` [PATCH net-next RFC 5/7] devlink: Add devlink notifications support for port params Vasundhara Volam
2018-12-05 13:02 ` Jiri Pirko
2018-12-05 5:56 ` [PATCH net-next RFC 6/7] devlink: Add a boolean generic port parameter Vasundhara Volam
2018-12-05 13:04 ` Jiri Pirko
2018-12-05 5:57 ` [PATCH net-next RFC 7/7] bnxt_en: Add bnxt_en initial port params table and register it Vasundhara Volam
2018-12-05 13:05 ` Jiri Pirko [this message]
2018-12-05 23:33 ` Jakub Kicinski
2018-12-06 0:01 ` Michael Chan
2018-12-06 0:42 ` Jakub Kicinski
2018-12-06 1:18 ` Michael Chan
2018-12-06 6:00 ` Jakub Kicinski
2018-12-06 6:41 ` Michael Chan
2018-12-06 7:11 ` Jakub Kicinski
2018-12-06 8:57 ` Michael Chan
2018-12-06 9:03 ` Jiri Pirko
2018-12-06 10:31 ` Vasundhara Volam
2018-12-06 11:11 ` Jiri Pirko
2018-12-06 10:36 ` Jakub Kicinski
2018-12-06 11:00 ` Michael Chan
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=20181205130546.GH2318@nanopsycho \
--to=jiri@resnulli.us \
--cc=davem@davemloft.net \
--cc=jiri@mellanox.com \
--cc=michael.chan@broadcom.com \
--cc=netdev@vger.kernel.org \
--cc=vasundhara-v.volam@broadcom.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).