Skip to content

Commit f62bb88

Browse files
committed
Merge branch '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue
Tony Nguyen says: ==================== Fix E825 initialization Grzegorz Nitka says: E825 products have incorrect initialization procedure, which may lead to initialization failures and register values. Fix E825 products initialization by adding correct sync delay, checking the PHY revision only for current PHY and adding proper destination device when reading port/quad. In addition, E825 uses PF ID for indexing per PF registers and as a primary PHY lane number, which is incorrect. * '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue: ice: Add correct PHY lane assignment ice: Fix ETH56G FC-FEC Rx offset value ice: Fix quad registers read on E825 ice: Fix E825 initialization ==================== Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents 9de1280 + 258f5f9 commit f62bb88

File tree

9 files changed

+209
-144
lines changed

9 files changed

+209
-144
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1665,6 +1665,7 @@ struct ice_aqc_get_port_options_elem {
16651665
#define ICE_AQC_PORT_OPT_MAX_LANE_25G 5
16661666
#define ICE_AQC_PORT_OPT_MAX_LANE_50G 6
16671667
#define ICE_AQC_PORT_OPT_MAX_LANE_100G 7
1668+
#define ICE_AQC_PORT_OPT_MAX_LANE_200G 8
16681669

16691670
u8 global_scid[2];
16701671
u8 phy_scid[2];

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

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4095,6 +4095,57 @@ ice_aq_set_port_option(struct ice_hw *hw, u8 lport, u8 lport_valid,
40954095
return ice_aq_send_cmd(hw, &desc, NULL, 0, NULL);
40964096
}
40974097

4098+
/**
4099+
* ice_get_phy_lane_number - Get PHY lane number for current adapter
4100+
* @hw: pointer to the hw struct
4101+
*
4102+
* Return: PHY lane number on success, negative error code otherwise.
4103+
*/
4104+
int ice_get_phy_lane_number(struct ice_hw *hw)
4105+
{
4106+
struct ice_aqc_get_port_options_elem *options;
4107+
unsigned int lport = 0;
4108+
unsigned int lane;
4109+
int err;
4110+
4111+
options = kcalloc(ICE_AQC_PORT_OPT_MAX, sizeof(*options), GFP_KERNEL);
4112+
if (!options)
4113+
return -ENOMEM;
4114+
4115+
for (lane = 0; lane < ICE_MAX_PORT_PER_PCI_DEV; lane++) {
4116+
u8 options_count = ICE_AQC_PORT_OPT_MAX;
4117+
u8 speed, active_idx, pending_idx;
4118+
bool active_valid, pending_valid;
4119+
4120+
err = ice_aq_get_port_options(hw, options, &options_count, lane,
4121+
true, &active_idx, &active_valid,
4122+
&pending_idx, &pending_valid);
4123+
if (err)
4124+
goto err;
4125+
4126+
if (!active_valid)
4127+
continue;
4128+
4129+
speed = options[active_idx].max_lane_speed;
4130+
/* If we don't get speed for this lane, it's unoccupied */
4131+
if (speed > ICE_AQC_PORT_OPT_MAX_LANE_200G)
4132+
continue;
4133+
4134+
if (hw->pf_id == lport) {
4135+
kfree(options);
4136+
return lane;
4137+
}
4138+
4139+
lport++;
4140+
}
4141+
4142+
/* PHY lane not found */
4143+
err = -ENXIO;
4144+
err:
4145+
kfree(options);
4146+
return err;
4147+
}
4148+
40984149
/**
40994150
* ice_aq_sff_eeprom
41004151
* @hw: pointer to the HW struct

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ ice_aq_get_port_options(struct ice_hw *hw,
193193
int
194194
ice_aq_set_port_option(struct ice_hw *hw, u8 lport, u8 lport_valid,
195195
u8 new_option);
196+
int ice_get_phy_lane_number(struct ice_hw *hw);
196197
int
197198
ice_aq_sff_eeprom(struct ice_hw *hw, u16 lport, u8 bus_addr,
198199
u16 mem_addr, u8 page, u8 set_page, u8 *data, u8 length,

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1144,7 +1144,7 @@ ice_link_event(struct ice_pf *pf, struct ice_port_info *pi, bool link_up,
11441144
if (link_up == old_link && link_speed == old_link_speed)
11451145
return 0;
11461146

1147-
ice_ptp_link_change(pf, pf->hw.pf_id, link_up);
1147+
ice_ptp_link_change(pf, link_up);
11481148

11491149
if (ice_is_dcb_active(pf)) {
11501150
if (test_bit(ICE_FLAG_DCB_ENA, pf->flags))
@@ -6790,7 +6790,7 @@ static int ice_up_complete(struct ice_vsi *vsi)
67906790
ice_print_link_msg(vsi, true);
67916791
netif_tx_start_all_queues(vsi->netdev);
67926792
netif_carrier_on(vsi->netdev);
6793-
ice_ptp_link_change(pf, pf->hw.pf_id, true);
6793+
ice_ptp_link_change(pf, true);
67946794
}
67956795

67966796
/* Perform an initial read of the statistics registers now to
@@ -7260,7 +7260,7 @@ int ice_down(struct ice_vsi *vsi)
72607260

72617261
if (vsi->netdev) {
72627262
vlan_err = ice_vsi_del_vlan_zero(vsi);
7263-
ice_ptp_link_change(vsi->back, vsi->back->hw.pf_id, false);
7263+
ice_ptp_link_change(vsi->back, false);
72647264
netif_carrier_off(vsi->netdev);
72657265
netif_tx_disable(vsi->netdev);
72667266
}

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

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1388,25 +1388,17 @@ ice_ptp_port_phy_restart(struct ice_ptp_port *ptp_port)
13881388
/**
13891389
* ice_ptp_link_change - Reconfigure PTP after link status change
13901390
* @pf: Board private structure
1391-
* @port: Port for which the PHY start is set
13921391
* @linkup: Link is up or down
13931392
*/
1394-
void ice_ptp_link_change(struct ice_pf *pf, u8 port, bool linkup)
1393+
void ice_ptp_link_change(struct ice_pf *pf, bool linkup)
13951394
{
13961395
struct ice_ptp_port *ptp_port;
13971396
struct ice_hw *hw = &pf->hw;
13981397

13991398
if (pf->ptp.state != ICE_PTP_READY)
14001399
return;
14011400

1402-
if (WARN_ON_ONCE(port >= hw->ptp.num_lports))
1403-
return;
1404-
14051401
ptp_port = &pf->ptp.port;
1406-
if (ice_is_e825c(hw) && hw->ptp.is_2x50g_muxed_topo)
1407-
port *= 2;
1408-
if (WARN_ON_ONCE(ptp_port->port_num != port))
1409-
return;
14101402

14111403
/* Update cached link status for this port immediately */
14121404
ptp_port->link_up = linkup;
@@ -3164,10 +3156,17 @@ void ice_ptp_init(struct ice_pf *pf)
31643156
{
31653157
struct ice_ptp *ptp = &pf->ptp;
31663158
struct ice_hw *hw = &pf->hw;
3167-
int err;
3159+
int lane_num, err;
31683160

31693161
ptp->state = ICE_PTP_INITIALIZING;
31703162

3163+
lane_num = ice_get_phy_lane_number(hw);
3164+
if (lane_num < 0) {
3165+
err = lane_num;
3166+
goto err_exit;
3167+
}
3168+
3169+
ptp->port.port_num = (u8)lane_num;
31713170
ice_ptp_init_hw(hw);
31723171

31733172
ice_ptp_init_tx_interrupt_mode(pf);
@@ -3188,10 +3187,6 @@ void ice_ptp_init(struct ice_pf *pf)
31883187
if (err)
31893188
goto err_exit;
31903189

3191-
ptp->port.port_num = hw->pf_id;
3192-
if (ice_is_e825c(hw) && hw->ptp.is_2x50g_muxed_topo)
3193-
ptp->port.port_num = hw->pf_id * 2;
3194-
31953190
err = ice_ptp_init_port(pf, &ptp->port);
31963191
if (err)
31973192
goto err_exit;

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ void ice_ptp_prepare_for_reset(struct ice_pf *pf,
310310
enum ice_reset_req reset_type);
311311
void ice_ptp_init(struct ice_pf *pf);
312312
void ice_ptp_release(struct ice_pf *pf);
313-
void ice_ptp_link_change(struct ice_pf *pf, u8 port, bool linkup);
313+
void ice_ptp_link_change(struct ice_pf *pf, bool linkup);
314314
#else /* IS_ENABLED(CONFIG_PTP_1588_CLOCK) */
315315
static inline int ice_ptp_set_ts_config(struct ice_pf *pf, struct ifreq *ifr)
316316
{
@@ -358,7 +358,7 @@ static inline void ice_ptp_prepare_for_reset(struct ice_pf *pf,
358358
}
359359
static inline void ice_ptp_init(struct ice_pf *pf) { }
360360
static inline void ice_ptp_release(struct ice_pf *pf) { }
361-
static inline void ice_ptp_link_change(struct ice_pf *pf, u8 port, bool linkup)
361+
static inline void ice_ptp_link_change(struct ice_pf *pf, bool linkup)
362362
{
363363
}
364364

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ struct ice_eth56g_mac_reg_cfg eth56g_mac_cfg[NUM_ICE_ETH56G_LNK_SPD] = {
131131
.rx_offset = {
132132
.serdes = 0xffffeb27, /* -10.42424 */
133133
.no_fec = 0xffffcccd, /* -25.6 */
134-
.fc = 0xfffe0014, /* -255.96 */
134+
.fc = 0xfffc557b, /* -469.26 */
135135
.sfd = 0x4a4, /* 2.32 */
136136
.bs_ds = 0x32 /* 0.0969697 */
137137
}

0 commit comments

Comments
 (0)