Skip to content

Commit a778616

Browse files
DanNowlinanguy11
authored andcommitted
ice: fix DDP package download for packages without signature segment
Commit 3cbdb03 ("ice: Add support for E830 DDP package segment") incorrectly removed support for package download for packages without a signature segment. These packages include the signature buffer inline in the configurations buffers, and not in a signature segment. Fix package download by providing download support for both packages with (ice_download_pkg_with_sig_seg()) and without signature segment (ice_download_pkg_without_sig_seg()). Fixes: 3cbdb03 ("ice: Add support for E830 DDP package segment") Reported-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com> Closes: https://lore.kernel.org/netdev/ZUT50a94kk2pMGKb@boxer/ Tested-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com> Reviewed-by: Wojciech Drewek <wojciech.drewek@intel.com> Reviewed-by: Jacob Keller <jacob.e.keller@intel.com> Signed-off-by: Dan Nowlin <dan.nowlin@intel.com> Signed-off-by: Paul Greenwalt <paul.greenwalt@intel.com> Reviewed-by: Simon Horman <horms@kernel.org> Tested-by: Arpana Arland <arpanax.arland@intel.com> (A Contingent worker at Intel) Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
1 parent 6db5f2c commit a778616

1 file changed

Lines changed: 100 additions & 3 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");

0 commit comments

Comments
 (0)