Skip to content

Commit 67af0bd

Browse files
committed
Merge branch '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue
Tony Nguyen says: ==================== Intel Wired LAN Driver Updates 2023-11-13 (ice) This series contains updates to ice driver only. Arkadiusz ensures the device is initialized with valid lock status value. He also removes range checking of dpll priority to allow firmware to process the request; supported values are firmware dependent. Finally, he removes setting of can change capability for pins that cannot be changed. Dan restores ability to load a package which doesn't contain a signature segment. * '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue: ice: fix DDP package download for packages without signature segment ice: dpll: fix output pin capabilities ice: dpll: fix check for dpll input priority range ice: dpll: fix initial lock status of dpll ==================== Link: https://lore.kernel.org/r/20231113230551.548489-1-anthony.l.nguyen@intel.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2 parents 9d350b2 + a778616 commit 67af0bd

5 files changed

Lines changed: 165 additions & 16 deletions

File tree

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

Lines changed: 100 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1479,14 +1479,14 @@ ice_post_dwnld_pkg_actions(struct ice_hw *hw)
14791479
}
14801480

14811481
/**
1482-
* ice_download_pkg
1482+
* ice_download_pkg_with_sig_seg
14831483
* @hw: pointer to the hardware structure
14841484
* @pkg_hdr: pointer to package header
14851485
*
14861486
* Handles the download of a complete package.
14871487
*/
14881488
static enum ice_ddp_state
1489-
ice_download_pkg(struct ice_hw *hw, struct ice_pkg_hdr *pkg_hdr)
1489+
ice_download_pkg_with_sig_seg(struct ice_hw *hw, struct ice_pkg_hdr *pkg_hdr)
14901490
{
14911491
enum ice_aq_err aq_err = hw->adminq.sq_last_status;
14921492
enum ice_ddp_state state = ICE_DDP_PKG_ERR;
@@ -1519,6 +1519,103 @@ ice_download_pkg(struct ice_hw *hw, struct ice_pkg_hdr *pkg_hdr)
15191519
state = ice_post_dwnld_pkg_actions(hw);
15201520

15211521
ice_release_global_cfg_lock(hw);
1522+
1523+
return state;
1524+
}
1525+
1526+
/**
1527+
* ice_dwnld_cfg_bufs
1528+
* @hw: pointer to the hardware structure
1529+
* @bufs: pointer to an array of buffers
1530+
* @count: the number of buffers in the array
1531+
*
1532+
* Obtains global config lock and downloads the package configuration buffers
1533+
* to the firmware.
1534+
*/
1535+
static enum ice_ddp_state
1536+
ice_dwnld_cfg_bufs(struct ice_hw *hw, struct ice_buf *bufs, u32 count)
1537+
{
1538+
enum ice_ddp_state state;
1539+
struct ice_buf_hdr *bh;
1540+
int status;
1541+
1542+
if (!bufs || !count)
1543+
return ICE_DDP_PKG_ERR;
1544+
1545+
/* If the first buffer's first section has its metadata bit set
1546+
* then there are no buffers to be downloaded, and the operation is
1547+
* considered a success.
1548+
*/
1549+
bh = (struct ice_buf_hdr *)bufs;
1550+
if (le32_to_cpu(bh->section_entry[0].type) & ICE_METADATA_BUF)
1551+
return ICE_DDP_PKG_SUCCESS;
1552+
1553+
status = ice_acquire_global_cfg_lock(hw, ICE_RES_WRITE);
1554+
if (status) {
1555+
if (status == -EALREADY)
1556+
return ICE_DDP_PKG_ALREADY_LOADED;
1557+
return ice_map_aq_err_to_ddp_state(hw->adminq.sq_last_status);
1558+
}
1559+
1560+
state = ice_dwnld_cfg_bufs_no_lock(hw, bufs, 0, count, true);
1561+
if (!state)
1562+
state = ice_post_dwnld_pkg_actions(hw);
1563+
1564+
ice_release_global_cfg_lock(hw);
1565+
1566+
return state;
1567+
}
1568+
1569+
/**
1570+
* ice_download_pkg_without_sig_seg
1571+
* @hw: pointer to the hardware structure
1572+
* @ice_seg: pointer to the segment of the package to be downloaded
1573+
*
1574+
* Handles the download of a complete package without signature segment.
1575+
*/
1576+
static enum ice_ddp_state
1577+
ice_download_pkg_without_sig_seg(struct ice_hw *hw, struct ice_seg *ice_seg)
1578+
{
1579+
struct ice_buf_table *ice_buf_tbl;
1580+
1581+
ice_debug(hw, ICE_DBG_PKG, "Segment format version: %d.%d.%d.%d\n",
1582+
ice_seg->hdr.seg_format_ver.major,
1583+
ice_seg->hdr.seg_format_ver.minor,
1584+
ice_seg->hdr.seg_format_ver.update,
1585+
ice_seg->hdr.seg_format_ver.draft);
1586+
1587+
ice_debug(hw, ICE_DBG_PKG, "Seg: type 0x%X, size %d, name %s\n",
1588+
le32_to_cpu(ice_seg->hdr.seg_type),
1589+
le32_to_cpu(ice_seg->hdr.seg_size), ice_seg->hdr.seg_id);
1590+
1591+
ice_buf_tbl = ice_find_buf_table(ice_seg);
1592+
1593+
ice_debug(hw, ICE_DBG_PKG, "Seg buf count: %d\n",
1594+
le32_to_cpu(ice_buf_tbl->buf_count));
1595+
1596+
return ice_dwnld_cfg_bufs(hw, ice_buf_tbl->buf_array,
1597+
le32_to_cpu(ice_buf_tbl->buf_count));
1598+
}
1599+
1600+
/**
1601+
* ice_download_pkg
1602+
* @hw: pointer to the hardware structure
1603+
* @pkg_hdr: pointer to package header
1604+
* @ice_seg: pointer to the segment of the package to be downloaded
1605+
*
1606+
* Handles the download of a complete package.
1607+
*/
1608+
static enum ice_ddp_state
1609+
ice_download_pkg(struct ice_hw *hw, struct ice_pkg_hdr *pkg_hdr,
1610+
struct ice_seg *ice_seg)
1611+
{
1612+
enum ice_ddp_state state;
1613+
1614+
if (hw->pkg_has_signing_seg)
1615+
state = ice_download_pkg_with_sig_seg(hw, pkg_hdr);
1616+
else
1617+
state = ice_download_pkg_without_sig_seg(hw, ice_seg);
1618+
15221619
ice_post_pkg_dwnld_vlan_mode_cfg(hw);
15231620

15241621
return state;
@@ -2083,7 +2180,7 @@ enum ice_ddp_state ice_init_pkg(struct ice_hw *hw, u8 *buf, u32 len)
20832180

20842181
/* initialize package hints and then download package */
20852182
ice_init_pkg_hints(hw, seg);
2086-
state = ice_download_pkg(hw, pkg);
2183+
state = ice_download_pkg(hw, pkg, seg);
20872184
if (state == ICE_DDP_PKG_ALREADY_LOADED) {
20882185
ice_debug(hw, ICE_DBG_INIT,
20892186
"package previously loaded - no work.\n");

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

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -815,12 +815,6 @@ ice_dpll_input_prio_set(const struct dpll_pin *pin, void *pin_priv,
815815
struct ice_pf *pf = d->pf;
816816
int ret;
817817

818-
if (prio > ICE_DPLL_PRIO_MAX) {
819-
NL_SET_ERR_MSG_FMT(extack, "prio out of supported range 0-%d",
820-
ICE_DPLL_PRIO_MAX);
821-
return -EINVAL;
822-
}
823-
824818
mutex_lock(&pf->dplls.lock);
825819
ret = ice_dpll_hw_input_prio_set(pf, d, p, prio, extack);
826820
mutex_unlock(&pf->dplls.lock);
@@ -1756,6 +1750,7 @@ ice_dpll_init_dpll(struct ice_pf *pf, struct ice_dpll *d, bool cgu,
17561750
}
17571751
d->pf = pf;
17581752
if (cgu) {
1753+
ice_dpll_update_state(pf, d, true);
17591754
ret = dpll_device_register(d->dpll, type, &ice_dpll_ops, d);
17601755
if (ret) {
17611756
dpll_device_put(d->dpll);
@@ -1796,8 +1791,6 @@ static int ice_dpll_init_worker(struct ice_pf *pf)
17961791
struct ice_dplls *d = &pf->dplls;
17971792
struct kthread_worker *kworker;
17981793

1799-
ice_dpll_update_state(pf, &d->eec, true);
1800-
ice_dpll_update_state(pf, &d->pps, true);
18011794
kthread_init_delayed_work(&d->work, ice_dpll_periodic_work);
18021795
kworker = kthread_create_worker(0, "ice-dplls-%s",
18031796
dev_name(ice_pf_to_dev(pf)));
@@ -1830,6 +1823,7 @@ ice_dpll_init_info_direct_pins(struct ice_pf *pf,
18301823
int num_pins, i, ret = -EINVAL;
18311824
struct ice_hw *hw = &pf->hw;
18321825
struct ice_dpll_pin *pins;
1826+
unsigned long caps;
18331827
u8 freq_supp_num;
18341828
bool input;
18351829

@@ -1849,6 +1843,7 @@ ice_dpll_init_info_direct_pins(struct ice_pf *pf,
18491843
}
18501844

18511845
for (i = 0; i < num_pins; i++) {
1846+
caps = 0;
18521847
pins[i].idx = i;
18531848
pins[i].prop.board_label = ice_cgu_get_pin_name(hw, i, input);
18541849
pins[i].prop.type = ice_cgu_get_pin_type(hw, i, input);
@@ -1861,8 +1856,8 @@ ice_dpll_init_info_direct_pins(struct ice_pf *pf,
18611856
&dp->input_prio[i]);
18621857
if (ret)
18631858
return ret;
1864-
pins[i].prop.capabilities |=
1865-
DPLL_PIN_CAPABILITIES_PRIORITY_CAN_CHANGE;
1859+
caps |= (DPLL_PIN_CAPABILITIES_PRIORITY_CAN_CHANGE |
1860+
DPLL_PIN_CAPABILITIES_STATE_CAN_CHANGE);
18661861
pins[i].prop.phase_range.min =
18671862
pf->dplls.input_phase_adj_max;
18681863
pins[i].prop.phase_range.max =
@@ -1872,9 +1867,11 @@ ice_dpll_init_info_direct_pins(struct ice_pf *pf,
18721867
pf->dplls.output_phase_adj_max;
18731868
pins[i].prop.phase_range.max =
18741869
-pf->dplls.output_phase_adj_max;
1870+
ret = ice_cgu_get_output_pin_state_caps(hw, i, &caps);
1871+
if (ret)
1872+
return ret;
18751873
}
1876-
pins[i].prop.capabilities |=
1877-
DPLL_PIN_CAPABILITIES_STATE_CAN_CHANGE;
1874+
pins[i].prop.capabilities = caps;
18781875
ret = ice_dpll_pin_state_update(pf, &pins[i], pin_type, NULL);
18791876
if (ret)
18801877
return ret;

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
#include "ice.h"
88

9-
#define ICE_DPLL_PRIO_MAX 0xF
109
#define ICE_DPLL_RCLK_NUM_MAX 4
1110

1211
/** ice_dpll_pin - store info about pins

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

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3961,3 +3961,57 @@ int ice_get_cgu_rclk_pin_info(struct ice_hw *hw, u8 *base_idx, u8 *pin_num)
39613961

39623962
return ret;
39633963
}
3964+
3965+
/**
3966+
* ice_cgu_get_output_pin_state_caps - get output pin state capabilities
3967+
* @hw: pointer to the hw struct
3968+
* @pin_id: id of a pin
3969+
* @caps: capabilities to modify
3970+
*
3971+
* Return:
3972+
* * 0 - success, state capabilities were modified
3973+
* * negative - failure, capabilities were not modified
3974+
*/
3975+
int ice_cgu_get_output_pin_state_caps(struct ice_hw *hw, u8 pin_id,
3976+
unsigned long *caps)
3977+
{
3978+
bool can_change = true;
3979+
3980+
switch (hw->device_id) {
3981+
case ICE_DEV_ID_E810C_SFP:
3982+
if (pin_id == ZL_OUT2 || pin_id == ZL_OUT3)
3983+
can_change = false;
3984+
break;
3985+
case ICE_DEV_ID_E810C_QSFP:
3986+
if (pin_id == ZL_OUT2 || pin_id == ZL_OUT3 || pin_id == ZL_OUT4)
3987+
can_change = false;
3988+
break;
3989+
case ICE_DEV_ID_E823L_10G_BASE_T:
3990+
case ICE_DEV_ID_E823L_1GBE:
3991+
case ICE_DEV_ID_E823L_BACKPLANE:
3992+
case ICE_DEV_ID_E823L_QSFP:
3993+
case ICE_DEV_ID_E823L_SFP:
3994+
case ICE_DEV_ID_E823C_10G_BASE_T:
3995+
case ICE_DEV_ID_E823C_BACKPLANE:
3996+
case ICE_DEV_ID_E823C_QSFP:
3997+
case ICE_DEV_ID_E823C_SFP:
3998+
case ICE_DEV_ID_E823C_SGMII:
3999+
if (hw->cgu_part_number ==
4000+
ICE_AQC_GET_LINK_TOPO_NODE_NR_ZL30632_80032 &&
4001+
pin_id == ZL_OUT2)
4002+
can_change = false;
4003+
else if (hw->cgu_part_number ==
4004+
ICE_AQC_GET_LINK_TOPO_NODE_NR_SI5383_5384 &&
4005+
pin_id == SI_OUT1)
4006+
can_change = false;
4007+
break;
4008+
default:
4009+
return -EINVAL;
4010+
}
4011+
if (can_change)
4012+
*caps |= DPLL_PIN_CAPABILITIES_STATE_CAN_CHANGE;
4013+
else
4014+
*caps &= ~DPLL_PIN_CAPABILITIES_STATE_CAN_CHANGE;
4015+
4016+
return 0;
4017+
}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,8 @@ int ice_get_cgu_state(struct ice_hw *hw, u8 dpll_idx,
282282
int ice_get_cgu_rclk_pin_info(struct ice_hw *hw, u8 *base_idx, u8 *pin_num);
283283

284284
void ice_ptp_init_phy_model(struct ice_hw *hw);
285+
int ice_cgu_get_output_pin_state_caps(struct ice_hw *hw, u8 pin_id,
286+
unsigned long *caps);
285287

286288
#define PFTSYN_SEM_BYTES 4
287289

0 commit comments

Comments
 (0)