Skip to content

Commit 2777d24

Browse files
pgreenwakuba-moo
authored andcommitted
ice: Add ice_get_link_status_datalen
The Get Link Status data length can vary with different versions of ice_aqc_get_link_status_data. Add ice_get_link_status_datalen() to return datalen for the specific ice_aqc_get_link_status_data version. Add new link partner fields to ice_aqc_get_link_status_data; PHY type, FEC, and flow control. Reviewed-by: Jesse Brandeburg <[email protected]> Co-developed-by: Pawel Chmielewski <[email protected]> Signed-off-by: Pawel Chmielewski <[email protected]> Reviewed-by: Simon Horman <[email protected]> Signed-off-by: Paul Greenwalt <[email protected]> Tested-by: Tony Brelinski <[email protected]> Signed-off-by: Jacob Keller <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 24407a0 commit 2777d24

File tree

2 files changed

+53
-6
lines changed

2 files changed

+53
-6
lines changed

drivers/net/ethernet/intel/ice/ice_adminq_cmd.h

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1329,10 +1329,39 @@ struct ice_aqc_get_link_status_data {
13291329
#define ICE_AQ_LINK_SPEED_100GB BIT(10)
13301330
#define ICE_AQ_LINK_SPEED_200GB BIT(11)
13311331
#define ICE_AQ_LINK_SPEED_UNKNOWN BIT(15)
1332-
__le32 reserved3; /* Aligns next field to 8-byte boundary */
1333-
__le64 phy_type_low; /* Use values from ICE_PHY_TYPE_LOW_* */
1334-
__le64 phy_type_high; /* Use values from ICE_PHY_TYPE_HIGH_* */
1335-
};
1332+
/* Aligns next field to 8-byte boundary */
1333+
__le16 reserved3;
1334+
u8 ext_fec_status;
1335+
/* RS 272 FEC enabled */
1336+
#define ICE_AQ_LINK_RS_272_FEC_EN BIT(0)
1337+
u8 reserved4;
1338+
/* Use values from ICE_PHY_TYPE_LOW_* */
1339+
__le64 phy_type_low;
1340+
/* Use values from ICE_PHY_TYPE_HIGH_* */
1341+
__le64 phy_type_high;
1342+
#define ICE_AQC_LS_DATA_SIZE_V1 \
1343+
offsetofend(struct ice_aqc_get_link_status_data, phy_type_high)
1344+
/* Get link status v2 link partner data */
1345+
__le64 lp_phy_type_low;
1346+
__le64 lp_phy_type_high;
1347+
u8 lp_fec_adv;
1348+
#define ICE_AQ_LINK_LP_10G_KR_FEC_CAP BIT(0)
1349+
#define ICE_AQ_LINK_LP_25G_KR_FEC_CAP BIT(1)
1350+
#define ICE_AQ_LINK_LP_RS_528_FEC_CAP BIT(2)
1351+
#define ICE_AQ_LINK_LP_50G_KR_272_FEC_CAP BIT(3)
1352+
#define ICE_AQ_LINK_LP_100G_KR_272_FEC_CAP BIT(4)
1353+
#define ICE_AQ_LINK_LP_200G_KR_272_FEC_CAP BIT(5)
1354+
u8 lp_fec_req;
1355+
#define ICE_AQ_LINK_LP_10G_KR_FEC_REQ BIT(0)
1356+
#define ICE_AQ_LINK_LP_25G_KR_FEC_REQ BIT(1)
1357+
#define ICE_AQ_LINK_LP_RS_528_FEC_REQ BIT(2)
1358+
#define ICE_AQ_LINK_LP_KR_272_FEC_REQ BIT(3)
1359+
u8 lp_flowcontrol;
1360+
#define ICE_AQ_LINK_LP_PAUSE_ADV BIT(0)
1361+
#define ICE_AQ_LINK_LP_ASM_DIR_ADV BIT(1)
1362+
#define ICE_AQC_LS_DATA_SIZE_V2 \
1363+
offsetofend(struct ice_aqc_get_link_status_data, lp_flowcontrol)
1364+
} __packed;
13361365

13371366
/* Set event mask command (direct 0x0613) */
13381367
struct ice_aqc_set_event_mask {

drivers/net/ethernet/intel/ice/ice_common.c

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -651,6 +651,24 @@ static enum ice_media_type ice_get_media_type(struct ice_port_info *pi)
651651
return ICE_MEDIA_UNKNOWN;
652652
}
653653

654+
/**
655+
* ice_get_link_status_datalen
656+
* @hw: pointer to the HW struct
657+
*
658+
* Returns datalength for the Get Link Status AQ command, which is bigger for
659+
* newer adapter families handled by ice driver.
660+
*/
661+
static u16 ice_get_link_status_datalen(struct ice_hw *hw)
662+
{
663+
switch (hw->mac_type) {
664+
case ICE_MAC_E830:
665+
return ICE_AQC_LS_DATA_SIZE_V2;
666+
case ICE_MAC_E810:
667+
default:
668+
return ICE_AQC_LS_DATA_SIZE_V1;
669+
}
670+
}
671+
654672
/**
655673
* ice_aq_get_link_info
656674
* @pi: port information structure
@@ -689,8 +707,8 @@ ice_aq_get_link_info(struct ice_port_info *pi, bool ena_lse,
689707
resp->cmd_flags = cpu_to_le16(cmd_flags);
690708
resp->lport_num = pi->lport;
691709

692-
status = ice_aq_send_cmd(hw, &desc, &link_data, sizeof(link_data), cd);
693-
710+
status = ice_aq_send_cmd(hw, &desc, &link_data,
711+
ice_get_link_status_datalen(hw), cd);
694712
if (status)
695713
return status;
696714

0 commit comments

Comments
 (0)