Skip to content

Commit

Permalink
net/bnxt: support 200G PAM4 link
Browse files Browse the repository at this point in the history
Thor based NICs can support PAM4 as wells as NRZ link negotiation.
With this patch we are adding support for 200G link speeds based on
PAM4 signaling. While PAM4 can negotiate speeds for 50G and 100G as
well, the PMD will use NRZ signalling for these speeds.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
  • Loading branch information
ajitkhaparde authored and Ferruh Yigit committed Sep 30, 2020
1 parent 6b67721 commit c23f9de
Show file tree
Hide file tree
Showing 6 changed files with 220 additions and 51 deletions.
6 changes: 6 additions & 0 deletions doc/guides/rel_notes/release_20_11.rst
Expand Up @@ -55,6 +55,12 @@ New Features
Also, make sure to start the actual text at the margin.
=======================================================
* **Updated Broadcom bnxt driver.**

Updated the Broadcom bnxt driver with new features and improvements, including:

* Added support for 200G PAM4 link speed.

* **Updated Cisco enic driver.**

* Added support for VF representors with single-queue Tx/Rx and flow API
Expand Down
7 changes: 7 additions & 0 deletions drivers/net/bnxt/bnxt.h
Expand Up @@ -292,6 +292,13 @@ struct bnxt_link_info {
uint32_t preemphasis;
uint8_t phy_type;
uint8_t media_type;
uint16_t support_auto_speeds;
uint8_t link_signal_mode;
uint16_t force_pam4_link_speed;
uint16_t support_pam4_speeds;
uint16_t auto_pam4_link_speeds;
uint16_t support_pam4_auto_speeds;
uint8_t req_signal_mode;
};

#define BNXT_COS_QUEUE_COUNT 8
Expand Down
6 changes: 5 additions & 1 deletion drivers/net/bnxt/bnxt_ethdev.c
Expand Up @@ -864,7 +864,11 @@ uint32_t bnxt_get_speed_capabilities(struct bnxt *bp)
speed_capa |= ETH_LINK_SPEED_50G;
if (link_speed & HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_SPEEDS_100GB)
speed_capa |= ETH_LINK_SPEED_100G;
if (link_speed & HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_SPEEDS_200GB)
if (link_speed & HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_PAM4_SPEEDS_50G)
speed_capa |= ETH_LINK_SPEED_50G;
if (link_speed & HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_PAM4_SPEEDS_100G)
speed_capa |= ETH_LINK_SPEED_100G;
if (link_speed & HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_PAM4_SPEEDS_200G)
speed_capa |= ETH_LINK_SPEED_200G;

if (bp->link_info->auto_mode ==
Expand Down
77 changes: 63 additions & 14 deletions drivers/net/bnxt/bnxt_hwrm.c
Expand Up @@ -1260,16 +1260,24 @@ static int bnxt_hwrm_port_phy_cfg(struct bnxt *bp, struct bnxt_link_info *conf)
}

req.flags = rte_cpu_to_le_32(conf->phy_flags);
req.force_link_speed = rte_cpu_to_le_16(conf->link_speed);
enables |= HWRM_PORT_PHY_CFG_INPUT_ENABLES_AUTO_MODE;
/*
* Note, ChiMP FW 20.2.1 and 20.2.2 return an error when we set
* any auto mode, even "none".
*/
if (!conf->link_speed) {
/* No speeds specified. Enable AutoNeg - all speeds */
enables |= HWRM_PORT_PHY_CFG_INPUT_ENABLES_AUTO_MODE;
req.auto_mode =
HWRM_PORT_PHY_CFG_INPUT_AUTO_MODE_ALL_SPEEDS;
} else {
if (bp->link_info->link_signal_mode) {
enables |=
HWRM_PORT_PHY_CFG_IN_EN_FORCE_PAM4_LINK_SPEED;
req.force_pam4_link_speed =
rte_cpu_to_le_16(conf->link_speed);
}
req.force_link_speed =
rte_cpu_to_le_16(conf->link_speed);
}
/* AutoNeg - Advertise speeds specified. */
if (conf->auto_link_speed_mask &&
Expand All @@ -1278,9 +1286,20 @@ static int bnxt_hwrm_port_phy_cfg(struct bnxt *bp, struct bnxt_link_info *conf)
HWRM_PORT_PHY_CFG_INPUT_AUTO_MODE_SPEED_MASK;
req.auto_link_speed_mask =
conf->auto_link_speed_mask;
enables |=
HWRM_PORT_PHY_CFG_INPUT_ENABLES_AUTO_LINK_SPEED_MASK;
if (conf->auto_pam4_link_speeds) {
enables |=
HWRM_PORT_PHY_CFG_IN_EN_AUTO_PAM4_LINK_SPD_MASK;
req.auto_link_pam4_speed_mask =
conf->auto_pam4_link_speeds;
} else {
enables |=
HWRM_PORT_PHY_CFG_IN_EN_AUTO_LINK_SPEED_MASK;
}
}
if (conf->auto_link_speed &&
!(conf->phy_flags & HWRM_PORT_PHY_CFG_INPUT_FLAGS_FORCE))
enables |=
HWRM_PORT_PHY_CFG_INPUT_ENABLES_AUTO_LINK_SPEED;

req.auto_duplex = conf->duplex;
enables |= HWRM_PORT_PHY_CFG_INPUT_ENABLES_AUTO_DUPLEX;
Expand Down Expand Up @@ -1340,7 +1359,13 @@ static int bnxt_hwrm_port_phy_qcfg(struct bnxt *bp,
link_info->phy_ver[0] = resp->phy_maj;
link_info->phy_ver[1] = resp->phy_min;
link_info->phy_ver[2] = resp->phy_bld;

link_info->link_signal_mode = rte_le_to_cpu_16(resp->link_signal_mode);
link_info->force_pam4_link_speed =
rte_le_to_cpu_16(resp->force_pam4_link_speed);
link_info->support_pam4_speeds =
rte_le_to_cpu_16(resp->support_pam4_speeds);
link_info->auto_pam4_link_speeds =
rte_le_to_cpu_16(resp->auto_pam4_link_speed_mask);
HWRM_UNLOCK();

PMD_DRV_LOG(DEBUG, "Link Speed:%d,Auto:%d:%x:%x,Support:%x,Force:%x\n",
Expand All @@ -1355,6 +1380,7 @@ int bnxt_hwrm_port_phy_qcaps(struct bnxt *bp)
int rc = 0;
struct hwrm_port_phy_qcaps_input req = {0};
struct hwrm_port_phy_qcaps_output *resp = bp->hwrm_cmd_resp_addr;
struct bnxt_link_info *link_info = bp->link_info;

if (BNXT_VF(bp) && !BNXT_VF_IS_TRUSTED(bp))
return 0;
Expand All @@ -1366,6 +1392,12 @@ int bnxt_hwrm_port_phy_qcaps(struct bnxt *bp)
HWRM_CHECK_RESULT();

bp->port_cnt = resp->port_cnt;
if (resp->supported_speeds_auto_mode)
link_info->support_auto_speeds =
rte_le_to_cpu_16(resp->supported_speeds_auto_mode);
if (resp->supported_pam4_speeds_auto_mode)
link_info->support_pam4_auto_speeds =
rte_le_to_cpu_16(resp->supported_pam4_speeds_auto_mode);

HWRM_UNLOCK();

Expand Down Expand Up @@ -2773,10 +2805,11 @@ static uint16_t bnxt_parse_eth_link_duplex(uint32_t conf_link_speed)

static uint16_t bnxt_check_eth_link_autoneg(uint32_t conf_link)
{
return (conf_link & ETH_LINK_SPEED_FIXED) ? 0 : 1;
return !conf_link;
}

static uint16_t bnxt_parse_eth_link_speed(uint32_t conf_link_speed)
static uint16_t bnxt_parse_eth_link_speed(uint32_t conf_link_speed,
uint16_t pam4_link)
{
uint16_t eth_link_speed = 0;

Expand Down Expand Up @@ -2815,16 +2848,18 @@ static uint16_t bnxt_parse_eth_link_speed(uint32_t conf_link_speed)
HWRM_PORT_PHY_CFG_INPUT_FORCE_LINK_SPEED_40GB;
break;
case ETH_LINK_SPEED_50G:
eth_link_speed =
eth_link_speed = pam4_link ?
HWRM_PORT_PHY_CFG_INPUT_FORCE_PAM4_LINK_SPEED_50GB :
HWRM_PORT_PHY_CFG_INPUT_FORCE_LINK_SPEED_50GB;
break;
case ETH_LINK_SPEED_100G:
eth_link_speed =
eth_link_speed = pam4_link ?
HWRM_PORT_PHY_CFG_INPUT_FORCE_PAM4_LINK_SPEED_100GB :
HWRM_PORT_PHY_CFG_INPUT_FORCE_LINK_SPEED_100GB;
break;
case ETH_LINK_SPEED_200G:
eth_link_speed =
HWRM_PORT_PHY_CFG_INPUT_FORCE_LINK_SPEED_200GB;
HWRM_PORT_PHY_CFG_INPUT_FORCE_PAM4_LINK_SPEED_200GB;
break;
default:
PMD_DRV_LOG(ERR,
Expand Down Expand Up @@ -2911,7 +2946,7 @@ bnxt_parse_eth_link_speed_mask(struct bnxt *bp, uint32_t link_speed)
if (link_speed & ETH_LINK_SPEED_100G)
ret |= HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_100GB;
if (link_speed & ETH_LINK_SPEED_200G)
ret |= HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_200GB;
ret |= HWRM_PORT_PHY_CFG_INPUT_FORCE_PAM4_LINK_SPEED_200GB;
return ret;
}

Expand Down Expand Up @@ -2985,12 +3020,16 @@ int bnxt_get_hwrm_link_config(struct bnxt *bp, struct rte_eth_link *link)
int rc = 0;
struct bnxt_link_info *link_info = bp->link_info;

rc = bnxt_hwrm_port_phy_qcaps(bp);
if (rc)
PMD_DRV_LOG(ERR, "Get link config failed with rc %d\n", rc);

rc = bnxt_hwrm_port_phy_qcfg(bp, link_info);
if (rc) {
PMD_DRV_LOG(ERR,
"Get link config failed with rc %d\n", rc);
PMD_DRV_LOG(ERR, "Get link config failed with rc %d\n", rc);
goto exit;
}

if (link_info->link_speed)
link->link_speed =
bnxt_parse_hw_link_speed(link_info->link_speed);
Expand Down Expand Up @@ -3035,7 +3074,8 @@ int bnxt_set_hwrm_link_config(struct bnxt *bp, bool link_up)
autoneg = 0;
}

speed = bnxt_parse_eth_link_speed(dev_conf->link_speeds);
speed = bnxt_parse_eth_link_speed(dev_conf->link_speeds,
bp->link_info->link_signal_mode);
link_req.phy_flags = HWRM_PORT_PHY_CFG_INPUT_FLAGS_RESET_PHY;
/* Autoneg can be done only when the FW allows.
* When user configures fixed speed of 40G and later changes to
Expand Down Expand Up @@ -3066,6 +3106,15 @@ int bnxt_set_hwrm_link_config(struct bnxt *bp, bool link_up)
/* If user wants a particular speed try that first. */
if (speed)
link_req.link_speed = speed;
else if (bp->link_info->force_pam4_link_speed)
link_req.link_speed =
bp->link_info->force_pam4_link_speed;
else if (bp->link_info->auto_pam4_link_speeds)
link_req.link_speed =
bp->link_info->auto_pam4_link_speeds;
else if (bp->link_info->support_pam4_speeds)
link_req.link_speed =
bp->link_info->support_pam4_speeds;
else if (bp->link_info->force_link_speed)
link_req.link_speed = bp->link_info->force_link_speed;
else
Expand Down
7 changes: 7 additions & 0 deletions drivers/net/bnxt/bnxt_hwrm.h
Expand Up @@ -48,6 +48,13 @@ struct hwrm_func_qstats_output;
#define HWRM_FUNC_RESOURCE_QCAPS_OUTPUT_VF_RESV_STRATEGY_MAXIMAL \
HWRM_FUNC_RESOURCE_QCAPS_OUTPUT_VF_RESERVATION_STRATEGY_MAXIMAL

#define HWRM_PORT_PHY_CFG_IN_EN_FORCE_PAM4_LINK_SPEED \
HWRM_PORT_PHY_CFG_INPUT_ENABLES_FORCE_PAM4_LINK_SPEED
#define HWRM_PORT_PHY_CFG_IN_EN_AUTO_PAM4_LINK_SPD_MASK \
HWRM_PORT_PHY_CFG_INPUT_ENABLES_AUTO_PAM4_LINK_SPEED_MASK
#define HWRM_PORT_PHY_CFG_IN_EN_AUTO_LINK_SPEED_MASK \
HWRM_PORT_PHY_CFG_INPUT_ENABLES_AUTO_LINK_SPEED_MASK

#define HWRM_CFA_ADV_FLOW_MGNT_QCAPS_L2_HDR_SRC_FILTER_EN \
HWRM_CFA_ADV_FLOW_MGNT_QCAPS_OUTPUT_FLAGS_L2_HEADER_SOURCE_FIELDS_SUPPORTED

Expand Down

0 comments on commit c23f9de

Please sign in to comment.