Skip to content

Commit c6cfc6c

Browse files
committed
Merge branch '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue
Tony Nguyen says: ==================== Intel Wired LAN Driver Updates 2023-08-17 (ice) This series contains updates to ice driver only. Jan removes unused functions and refactors code to make, possible, functions static. Jake rearranges some functions to be logically grouped. Marcin removes an unnecessary call to disable VLAN stripping. Yang Yingliang utilizes list_for_each_entry() helper for a couple list traversals. Przemek removes some parameters from ice_aq_alloc_free_res() which were always the same and reworks ice_aq_wait_for_event() to reduce chance of race. * '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue: ice: split ice_aq_wait_for_event() func into two ice: embed &ice_rq_event_info event into struct ice_aq_task ice: ice_aq_check_events: fix off-by-one check when filling buffer ice: drop two params from ice_aq_alloc_free_res() ice: use list_for_each_entry() helper ice: Remove redundant VSI configuration in eswitch setup ice: move E810T functions to before device agnostic ones ice: refactor ice_vsi_is_vlan_pruning_ena ice: refactor ice_ptp_hw to make functions static ice: refactor ice_sched to make functions static ice: Utilize assign_bit() helper ice: refactor ice_vf_lib to make functions static ice: refactor ice_lib to make functions static ice: refactor ice_ddp to make functions static ice: remove unused methods ==================== Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents 829b335 + fb9840c commit c6cfc6c

19 files changed

+624
-735
lines changed

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

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -917,8 +917,25 @@ void ice_fdir_release_flows(struct ice_hw *hw);
917917
void ice_fdir_replay_flows(struct ice_hw *hw);
918918
void ice_fdir_replay_fltrs(struct ice_pf *pf);
919919
int ice_fdir_create_dflt_rules(struct ice_pf *pf);
920-
int ice_aq_wait_for_event(struct ice_pf *pf, u16 opcode, unsigned long timeout,
921-
struct ice_rq_event_info *event);
920+
921+
enum ice_aq_task_state {
922+
ICE_AQ_TASK_NOT_PREPARED,
923+
ICE_AQ_TASK_WAITING,
924+
ICE_AQ_TASK_COMPLETE,
925+
ICE_AQ_TASK_CANCELED,
926+
};
927+
928+
struct ice_aq_task {
929+
struct hlist_node entry;
930+
struct ice_rq_event_info event;
931+
enum ice_aq_task_state state;
932+
u16 opcode;
933+
};
934+
935+
void ice_aq_prep_for_event(struct ice_pf *pf, struct ice_aq_task *task,
936+
u16 opcode);
937+
int ice_aq_wait_for_event(struct ice_pf *pf, struct ice_aq_task *task,
938+
unsigned long timeout);
922939
int ice_open(struct net_device *netdev);
923940
int ice_open_internal(struct net_device *netdev);
924941
int ice_stop(struct net_device *netdev);

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

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2000,37 +2000,31 @@ void ice_release_res(struct ice_hw *hw, enum ice_aq_res_ids res)
20002000
/**
20012001
* ice_aq_alloc_free_res - command to allocate/free resources
20022002
* @hw: pointer to the HW struct
2003-
* @num_entries: number of resource entries in buffer
20042003
* @buf: Indirect buffer to hold data parameters and response
20052004
* @buf_size: size of buffer for indirect commands
20062005
* @opc: pass in the command opcode
2007-
* @cd: pointer to command details structure or NULL
20082006
*
20092007
* Helper function to allocate/free resources using the admin queue commands
20102008
*/
2011-
int
2012-
ice_aq_alloc_free_res(struct ice_hw *hw, u16 num_entries,
2013-
struct ice_aqc_alloc_free_res_elem *buf, u16 buf_size,
2014-
enum ice_adminq_opc opc, struct ice_sq_cd *cd)
2009+
int ice_aq_alloc_free_res(struct ice_hw *hw,
2010+
struct ice_aqc_alloc_free_res_elem *buf, u16 buf_size,
2011+
enum ice_adminq_opc opc)
20152012
{
20162013
struct ice_aqc_alloc_free_res_cmd *cmd;
20172014
struct ice_aq_desc desc;
20182015

20192016
cmd = &desc.params.sw_res_ctrl;
20202017

2021-
if (!buf)
2022-
return -EINVAL;
2023-
2024-
if (buf_size < flex_array_size(buf, elem, num_entries))
2018+
if (!buf || buf_size < flex_array_size(buf, elem, 1))
20252019
return -EINVAL;
20262020

20272021
ice_fill_dflt_direct_cmd_desc(&desc, opc);
20282022

20292023
desc.flags |= cpu_to_le16(ICE_AQ_FLAG_RD);
20302024

2031-
cmd->num_entries = cpu_to_le16(num_entries);
2025+
cmd->num_entries = cpu_to_le16(1);
20322026

2033-
return ice_aq_send_cmd(hw, &desc, buf, buf_size, cd);
2027+
return ice_aq_send_cmd(hw, &desc, buf, buf_size, NULL);
20342028
}
20352029

20362030
/**
@@ -2060,8 +2054,7 @@ ice_alloc_hw_res(struct ice_hw *hw, u16 type, u16 num, bool btm, u16 *res)
20602054
if (btm)
20612055
buf->res_type |= cpu_to_le16(ICE_AQC_RES_TYPE_FLAG_SCAN_BOTTOM);
20622056

2063-
status = ice_aq_alloc_free_res(hw, 1, buf, buf_len,
2064-
ice_aqc_opc_alloc_res, NULL);
2057+
status = ice_aq_alloc_free_res(hw, buf, buf_len, ice_aqc_opc_alloc_res);
20652058
if (status)
20662059
goto ice_alloc_res_exit;
20672060

@@ -2095,8 +2088,7 @@ int ice_free_hw_res(struct ice_hw *hw, u16 type, u16 num, u16 *res)
20952088
buf->res_type = cpu_to_le16(type);
20962089
memcpy(buf->elem, res, sizeof(*buf->elem) * num);
20972090

2098-
status = ice_aq_alloc_free_res(hw, num, buf, buf_len,
2099-
ice_aqc_opc_free_res, NULL);
2091+
status = ice_aq_alloc_free_res(hw, buf, buf_len, ice_aqc_opc_free_res);
21002092
if (status)
21012093
ice_debug(hw, ICE_DBG_SW, "CQ CMD Buffer:\n");
21022094

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,9 @@ int
3838
ice_alloc_hw_res(struct ice_hw *hw, u16 type, u16 num, bool btm, u16 *res);
3939
int
4040
ice_free_hw_res(struct ice_hw *hw, u16 type, u16 num, u16 *res);
41-
int
42-
ice_aq_alloc_free_res(struct ice_hw *hw, u16 num_entries,
43-
struct ice_aqc_alloc_free_res_elem *buf, u16 buf_size,
44-
enum ice_adminq_opc opc, struct ice_sq_cd *cd);
41+
int ice_aq_alloc_free_res(struct ice_hw *hw,
42+
struct ice_aqc_alloc_free_res_elem *buf, u16 buf_size,
43+
enum ice_adminq_opc opc);
4544
bool ice_is_sbq_supported(struct ice_hw *hw);
4645
struct ice_ctl_q_info *ice_get_sbq(struct ice_hw *hw);
4746
int

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

Lines changed: 61 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ static const struct ice_tunnel_type_scan tnls[] = {
3030
* Verifies various attributes of the package file, including length, format
3131
* version, and the requirement of at least one segment.
3232
*/
33-
enum ice_ddp_state ice_verify_pkg(struct ice_pkg_hdr *pkg, u32 len)
33+
static enum ice_ddp_state ice_verify_pkg(struct ice_pkg_hdr *pkg, u32 len)
3434
{
3535
u32 seg_count;
3636
u32 i;
@@ -118,7 +118,7 @@ static enum ice_ddp_state ice_chk_pkg_version(struct ice_pkg_ver *pkg_ver)
118118
*
119119
* This helper function validates a buffer's header.
120120
*/
121-
struct ice_buf_hdr *ice_pkg_val_buf(struct ice_buf *buf)
121+
static struct ice_buf_hdr *ice_pkg_val_buf(struct ice_buf *buf)
122122
{
123123
struct ice_buf_hdr *hdr;
124124
u16 section_count;
@@ -1152,6 +1152,54 @@ static void ice_release_global_cfg_lock(struct ice_hw *hw)
11521152
ice_release_res(hw, ICE_GLOBAL_CFG_LOCK_RES_ID);
11531153
}
11541154

1155+
/**
1156+
* ice_aq_download_pkg
1157+
* @hw: pointer to the hardware structure
1158+
* @pkg_buf: the package buffer to transfer
1159+
* @buf_size: the size of the package buffer
1160+
* @last_buf: last buffer indicator
1161+
* @error_offset: returns error offset
1162+
* @error_info: returns error information
1163+
* @cd: pointer to command details structure or NULL
1164+
*
1165+
* Download Package (0x0C40)
1166+
*/
1167+
static int
1168+
ice_aq_download_pkg(struct ice_hw *hw, struct ice_buf_hdr *pkg_buf,
1169+
u16 buf_size, bool last_buf, u32 *error_offset,
1170+
u32 *error_info, struct ice_sq_cd *cd)
1171+
{
1172+
struct ice_aqc_download_pkg *cmd;
1173+
struct ice_aq_desc desc;
1174+
int status;
1175+
1176+
if (error_offset)
1177+
*error_offset = 0;
1178+
if (error_info)
1179+
*error_info = 0;
1180+
1181+
cmd = &desc.params.download_pkg;
1182+
ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_download_pkg);
1183+
desc.flags |= cpu_to_le16(ICE_AQ_FLAG_RD);
1184+
1185+
if (last_buf)
1186+
cmd->flags |= ICE_AQC_DOWNLOAD_PKG_LAST_BUF;
1187+
1188+
status = ice_aq_send_cmd(hw, &desc, pkg_buf, buf_size, cd);
1189+
if (status == -EIO) {
1190+
/* Read error from buffer only when the FW returned an error */
1191+
struct ice_aqc_download_pkg_resp *resp;
1192+
1193+
resp = (struct ice_aqc_download_pkg_resp *)pkg_buf;
1194+
if (error_offset)
1195+
*error_offset = le32_to_cpu(resp->error_offset);
1196+
if (error_info)
1197+
*error_info = le32_to_cpu(resp->error_info);
1198+
}
1199+
1200+
return status;
1201+
}
1202+
11551203
/**
11561204
* ice_dwnld_cfg_bufs
11571205
* @hw: pointer to the hardware structure
@@ -1294,20 +1342,20 @@ static enum ice_ddp_state ice_download_pkg(struct ice_hw *hw,
12941342
}
12951343

12961344
/**
1297-
* ice_aq_download_pkg
1345+
* ice_aq_update_pkg
12981346
* @hw: pointer to the hardware structure
1299-
* @pkg_buf: the package buffer to transfer
1300-
* @buf_size: the size of the package buffer
1347+
* @pkg_buf: the package cmd buffer
1348+
* @buf_size: the size of the package cmd buffer
13011349
* @last_buf: last buffer indicator
13021350
* @error_offset: returns error offset
13031351
* @error_info: returns error information
13041352
* @cd: pointer to command details structure or NULL
13051353
*
1306-
* Download Package (0x0C40)
1354+
* Update Package (0x0C42)
13071355
*/
1308-
int ice_aq_download_pkg(struct ice_hw *hw, struct ice_buf_hdr *pkg_buf,
1309-
u16 buf_size, bool last_buf, u32 *error_offset,
1310-
u32 *error_info, struct ice_sq_cd *cd)
1356+
static int ice_aq_update_pkg(struct ice_hw *hw, struct ice_buf_hdr *pkg_buf,
1357+
u16 buf_size, bool last_buf, u32 *error_offset,
1358+
u32 *error_info, struct ice_sq_cd *cd)
13111359
{
13121360
struct ice_aqc_download_pkg *cmd;
13131361
struct ice_aq_desc desc;
@@ -1319,7 +1367,7 @@ int ice_aq_download_pkg(struct ice_hw *hw, struct ice_buf_hdr *pkg_buf,
13191367
*error_info = 0;
13201368

13211369
cmd = &desc.params.download_pkg;
1322-
ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_download_pkg);
1370+
ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_update_pkg);
13231371
desc.flags |= cpu_to_le16(ICE_AQ_FLAG_RD);
13241372

13251373
if (last_buf)
@@ -1360,53 +1408,6 @@ int ice_aq_upload_section(struct ice_hw *hw, struct ice_buf_hdr *pkg_buf,
13601408
return ice_aq_send_cmd(hw, &desc, pkg_buf, buf_size, cd);
13611409
}
13621410

1363-
/**
1364-
* ice_aq_update_pkg
1365-
* @hw: pointer to the hardware structure
1366-
* @pkg_buf: the package cmd buffer
1367-
* @buf_size: the size of the package cmd buffer
1368-
* @last_buf: last buffer indicator
1369-
* @error_offset: returns error offset
1370-
* @error_info: returns error information
1371-
* @cd: pointer to command details structure or NULL
1372-
*
1373-
* Update Package (0x0C42)
1374-
*/
1375-
static int ice_aq_update_pkg(struct ice_hw *hw, struct ice_buf_hdr *pkg_buf,
1376-
u16 buf_size, bool last_buf, u32 *error_offset,
1377-
u32 *error_info, struct ice_sq_cd *cd)
1378-
{
1379-
struct ice_aqc_download_pkg *cmd;
1380-
struct ice_aq_desc desc;
1381-
int status;
1382-
1383-
if (error_offset)
1384-
*error_offset = 0;
1385-
if (error_info)
1386-
*error_info = 0;
1387-
1388-
cmd = &desc.params.download_pkg;
1389-
ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_update_pkg);
1390-
desc.flags |= cpu_to_le16(ICE_AQ_FLAG_RD);
1391-
1392-
if (last_buf)
1393-
cmd->flags |= ICE_AQC_DOWNLOAD_PKG_LAST_BUF;
1394-
1395-
status = ice_aq_send_cmd(hw, &desc, pkg_buf, buf_size, cd);
1396-
if (status == -EIO) {
1397-
/* Read error from buffer only when the FW returned an error */
1398-
struct ice_aqc_download_pkg_resp *resp;
1399-
1400-
resp = (struct ice_aqc_download_pkg_resp *)pkg_buf;
1401-
if (error_offset)
1402-
*error_offset = le32_to_cpu(resp->error_offset);
1403-
if (error_info)
1404-
*error_info = le32_to_cpu(resp->error_info);
1405-
}
1406-
1407-
return status;
1408-
}
1409-
14101411
/**
14111412
* ice_update_pkg_no_lock
14121413
* @hw: pointer to the hardware structure
@@ -1470,8 +1471,9 @@ int ice_update_pkg(struct ice_hw *hw, struct ice_buf *bufs, u32 count)
14701471
* success it returns a pointer to the segment header, otherwise it will
14711472
* return NULL.
14721473
*/
1473-
struct ice_generic_seg_hdr *ice_find_seg_in_pkg(struct ice_hw *hw, u32 seg_type,
1474-
struct ice_pkg_hdr *pkg_hdr)
1474+
static struct ice_generic_seg_hdr *
1475+
ice_find_seg_in_pkg(struct ice_hw *hw, u32 seg_type,
1476+
struct ice_pkg_hdr *pkg_hdr)
14751477
{
14761478
u32 i;
14771479

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

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -416,21 +416,13 @@ struct ice_pkg_enum {
416416
void *(*handler)(u32 sect_type, void *section, u32 index, u32 *offset);
417417
};
418418

419-
int ice_aq_download_pkg(struct ice_hw *hw, struct ice_buf_hdr *pkg_buf,
420-
u16 buf_size, bool last_buf, u32 *error_offset,
421-
u32 *error_info, struct ice_sq_cd *cd);
422419
int ice_aq_upload_section(struct ice_hw *hw, struct ice_buf_hdr *pkg_buf,
423420
u16 buf_size, struct ice_sq_cd *cd);
424421

425422
void *ice_pkg_buf_alloc_section(struct ice_buf_build *bld, u32 type, u16 size);
426423

427-
enum ice_ddp_state ice_verify_pkg(struct ice_pkg_hdr *pkg, u32 len);
428-
429424
struct ice_buf_build *ice_pkg_buf_alloc(struct ice_hw *hw);
430425

431-
struct ice_generic_seg_hdr *ice_find_seg_in_pkg(struct ice_hw *hw, u32 seg_type,
432-
struct ice_pkg_hdr *pkg_hdr);
433-
434426
int ice_update_pkg_no_lock(struct ice_hw *hw, struct ice_buf *bufs, u32 count);
435427
int ice_update_pkg(struct ice_hw *hw, struct ice_buf *bufs, u32 count);
436428

@@ -439,6 +431,4 @@ u16 ice_pkg_buf_get_active_sections(struct ice_buf_build *bld);
439431
void *ice_pkg_enum_section(struct ice_seg *ice_seg, struct ice_pkg_enum *state,
440432
u32 sect_type);
441433

442-
struct ice_buf_hdr *ice_pkg_val_buf(struct ice_buf *buf);
443-
444434
#endif

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,6 @@ static int ice_eswitch_setup_env(struct ice_pf *pf)
8484
struct ice_vsi_vlan_ops *vlan_ops;
8585
bool rule_added = false;
8686

87-
vlan_ops = ice_get_compat_vsi_vlan_ops(ctrl_vsi);
88-
if (vlan_ops->dis_stripping(ctrl_vsi))
89-
return -ENODEV;
90-
9187
ice_remove_vsi_fltr(&pf->hw, uplink_vsi->idx);
9288

9389
netif_addr_lock_bh(uplink_netdev);

0 commit comments

Comments
 (0)