From: Michael Chan <michael.chan@broadcom.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org
Subject: [PATCH net-next 10/15] bnxt_en: Refactor the initialization of the ethtool link settings.
Date: Sat, 23 Nov 2019 03:26:05 -0500 [thread overview]
Message-ID: <1574497570-22102-11-git-send-email-michael.chan@broadcom.com> (raw)
In-Reply-To: <1574497570-22102-1-git-send-email-michael.chan@broadcom.com>
Refactor this logic in bnxt_probe_phy() into a separate function
bnxt_init_ethtool_link_settings(). It used to be that the settable
link settings will never be changed without going through ethtool.
So we only needed to do this once in bnxt_probe_phy(). Now, another
function sharing the port may change it and we may need to re-initialize
the ethtool settings again in run-time.
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
---
drivers/net/ethernet/broadcom/bnxt/bnxt.c | 46 +++++++++++++++++--------------
1 file changed, 26 insertions(+), 20 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index 9d02232..1b86ba8 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -10249,6 +10249,31 @@ static void bnxt_chk_missed_irq(struct bnxt *bp)
static void bnxt_cfg_ntp_filters(struct bnxt *);
+static void bnxt_init_ethtool_link_settings(struct bnxt *bp)
+{
+ struct bnxt_link_info *link_info = &bp->link_info;
+
+ if (BNXT_AUTO_MODE(link_info->auto_mode)) {
+ link_info->autoneg = BNXT_AUTONEG_SPEED;
+ if (bp->hwrm_spec_code >= 0x10201) {
+ if (link_info->auto_pause_setting &
+ PORT_PHY_CFG_REQ_AUTO_PAUSE_AUTONEG_PAUSE)
+ link_info->autoneg |= BNXT_AUTONEG_FLOW_CTRL;
+ } else {
+ link_info->autoneg |= BNXT_AUTONEG_FLOW_CTRL;
+ }
+ link_info->advertising = link_info->auto_link_speeds;
+ } else {
+ link_info->req_link_speed = link_info->force_link_speed;
+ link_info->req_duplex = link_info->duplex_setting;
+ }
+ if (link_info->autoneg & BNXT_AUTONEG_FLOW_CTRL)
+ link_info->req_flow_ctrl =
+ link_info->auto_pause_setting & BNXT_LINK_PAUSE_BOTH;
+ else
+ link_info->req_flow_ctrl = link_info->force_pause_setting;
+}
+
static void bnxt_sp_task(struct work_struct *work)
{
struct bnxt *bp = container_of(work, struct bnxt, sp_task);
@@ -11411,26 +11436,7 @@ static int bnxt_probe_phy(struct bnxt *bp, bool fw_dflt)
if (!fw_dflt)
return 0;
- /*initialize the ethool setting copy with NVM settings */
- if (BNXT_AUTO_MODE(link_info->auto_mode)) {
- link_info->autoneg = BNXT_AUTONEG_SPEED;
- if (bp->hwrm_spec_code >= 0x10201) {
- if (link_info->auto_pause_setting &
- PORT_PHY_CFG_REQ_AUTO_PAUSE_AUTONEG_PAUSE)
- link_info->autoneg |= BNXT_AUTONEG_FLOW_CTRL;
- } else {
- link_info->autoneg |= BNXT_AUTONEG_FLOW_CTRL;
- }
- link_info->advertising = link_info->auto_link_speeds;
- } else {
- link_info->req_link_speed = link_info->force_link_speed;
- link_info->req_duplex = link_info->duplex_setting;
- }
- if (link_info->autoneg & BNXT_AUTONEG_FLOW_CTRL)
- link_info->req_flow_ctrl =
- link_info->auto_pause_setting & BNXT_LINK_PAUSE_BOTH;
- else
- link_info->req_flow_ctrl = link_info->force_pause_setting;
+ bnxt_init_ethtool_link_settings(bp);
return 0;
}
--
2.5.1
next prev parent reply other threads:[~2019-11-23 8:26 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-23 8:25 [PATCH net-next 00/15] bnxt_en: Updates Michael Chan
2019-11-23 8:25 ` [PATCH net-next 01/15] bnxt_en: Add chip IDs for 57452 and 57454 chips Michael Chan
2019-11-23 8:25 ` [PATCH net-next 02/15] bnxt_en: Disable/enable Bus master during suspend/resume Michael Chan
2019-11-23 8:25 ` [PATCH net-next 03/15] bnxt_en: Do driver unregister cleanup in bnxt_init_one() failure path Michael Chan
2019-11-23 8:25 ` [PATCH net-next 04/15] bnxt_en: Combine 2 functions calling the same HWRM_DRV_RGTR fw command Michael Chan
2019-11-23 8:26 ` [PATCH net-next 05/15] bnxt_en: Send FUNC_RESOURCE_QCAPS command in bnxt_resume() Michael Chan
2019-11-23 8:26 ` [PATCH net-next 06/15] bnxt_en: Fix suspend/resume path on 57500 chips Michael Chan
2019-11-23 8:26 ` [PATCH net-next 07/15] bnxt_en: Initialize context memory to the value specified by firmware Michael Chan
2019-11-23 8:26 ` [PATCH net-next 08/15] bnxt_en: Assign more RSS context resources to the VFs Michael Chan
2019-11-23 8:26 ` [PATCH net-next 09/15] bnxt_en: Skip disabling autoneg before PHY loopback when appropriate Michael Chan
2019-11-23 8:26 ` Michael Chan [this message]
2019-11-23 8:26 ` [PATCH net-next 11/15] bnxt_en: Add async. event logic for PHY configuration changes Michael Chan
2019-11-23 8:26 ` [PATCH net-next 12/15] bnxt_en: Allow PHY settings on multi-function or NPAR PFs if allowed by FW Michael Chan
2019-11-23 8:26 ` [PATCH net-next 13/15] bnxt_en: Add support for flashing the device via devlink Michael Chan
2019-11-23 8:26 ` [PATCH net-next 14/15] bnxt_en: Rename switch_id to dsn Michael Chan
2019-11-23 8:26 ` [PATCH net-next 15/15] bnxt_en: Add support for devlink info command Michael Chan
2019-11-23 19:55 ` Jakub Kicinski
2019-11-23 20:15 ` Michael Chan
2019-11-24 0:09 ` Jakub Kicinski
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=1574497570-22102-11-git-send-email-michael.chan@broadcom.com \
--to=michael.chan@broadcom.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.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).